AlmondTill/G3N API

Plan with Aldric — from a conversation to real records

How a conversation becomes records safely: Aldric drafts a plan in the chat, taking it opens a scratchpad, and nothing exists until you review, approve, and realize the plan under your own permissions.

Work · a guided walk in 3 steps.

The steps

  1. Ask Aldric — Aldric answers from your own records and may attach a drafted plan to a reply — problems the checker finds are shown on the exact step, kept word for word. — createConsultation, askConsultation
  2. Take the plan — Taking turns the drafted plan into a scratchpad of your own — still nothing created. — takeConsultationPlan
  3. Review, approve, realize — The scratchpad shows exactly what will be born; approval pins the reviewed plan; realizing creates every record under your own permissions and remembers what it made. — transitionScratchpad, realizeScratchpad

The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

createConsultation

createConsultation — mutation · Create a new consultation — your chat with Aldric; the transcript and its rolling summary are the record at your organization.

Example request

mutation ExampleCreateConsultation($input: NewConsultationInput!) {
  createConsultation(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    turnCount
    summary
    summarizedThroughSeq
    followOnOfId
    idleArchiveAt
    turnsTierAt
    turnsTier
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans"
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "createConsultation": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "CI-EXMP-0000-000F",
      "type": "Consultation",
      "caption": "Blue jeans",
      "status": "open",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "turnCount": 1,
      "summary": "<summary>",
      "summarizedThroughSeq": 1,
      "followOnOfId": "01900000-0000-7000-8000-7d2662410000",
      "idleArchiveAt": "2027-01-31T00:00:00.000Z",
      "turnsTierAt": "2027-01-31T00:00:00.000Z",
      "turnsTier": "<turns tier>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

askConsultation

askConsultation — mutation · Ask Aldric one question in a consultation — the reply may include a drafted plan of records to create.

Example request

mutation ExampleAskConsultation($input: AskConsultationInput!) {
  askConsultation(input: $input) {
    consultation {
      id
      sysId
      type
      caption
      status
      parentId
      rootId
      createdAt
      updatedAt
      revisionNum
      revision
      turnCount
      summary
      summarizedThroughSeq
      followOnOfId
      idleArchiveAt
      turnsTierAt
      turnsTier
    }
  }
}

Variables:

{
  "input": {
    "id": "01900000-0000-7000-8000-37386ae00000",
    "revision": "01900000-0000-7000-8000-b7960e180000",
    "message": "Restock before the weekend.",
    "materialIds": [
      "01900000-0000-7000-8000-a36392ca0000"
    ]
  }
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "askConsultation": {
      "consultation": {
        "id": "01900000-0000-7000-8000-37386ae00000",
        "sysId": "CI-EXMP-0000-000F",
        "type": "Consultation",
        "caption": "Blue jeans",
        "status": "open",
        "parentId": "01900000-0000-7000-8000-065235280000",
        "rootId": "01900000-0000-7000-8000-a093dd800000",
        "createdAt": "2027-01-31T00:00:00.000Z",
        "updatedAt": "2027-01-31T00:00:00.000Z",
        "revisionNum": 1,
        "revision": "01900000-0000-7000-8000-b7960e180000",
        "turnCount": 1,
        "summary": "<summary>",
        "summarizedThroughSeq": 1,
        "followOnOfId": "01900000-0000-7000-8000-7d2662410000",
        "idleArchiveAt": "2027-01-31T00:00:00.000Z",
        "turnsTierAt": "2027-01-31T00:00:00.000Z",
        "turnsTier": "<turns tier>"
      }
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

takeConsultationPlan

takeConsultationPlan — mutation · Take a drafted plan from one of Aldric's replies — a scratchpad is created with it, ready for your review and approval.

Example request

mutation ExampleTakeConsultationPlan($id: ID!, $revision: ID!, $seq: Int!, $reason: String) {
  takeConsultationPlan(id: $id, revision: $revision, seq: $seq, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    origin
    intent
    planRevision
    approvedPlanRevision
    inFlightSeq
    realizationFault
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "seq": 1,
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "takeConsultationPlan": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SD-EXMP-0000-000F",
      "type": "Scratchpad",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "origin": "<origin>",
      "intent": "<intent>",
      "planRevision": 1,
      "approvedPlanRevision": 1,
      "inFlightSeq": 1,
      "realizationFault": "<realization fault>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

transitionScratchpad

transitionScratchpad — mutation · Move a scratchpad through its life — hold the plan for review, reopen it for editing, approve it, or abandon it.

Example request

mutation ExampleTransitionScratchpad($id: ID!, $revision: ID!, $op: ScratchpadTransitionOp!, $reason: String) {
  transitionScratchpad(id: $id, revision: $revision, op: $op, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    origin
    intent
    planRevision
    approvedPlanRevision
    inFlightSeq
    realizationFault
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "op": "ready",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "transitionScratchpad": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SD-EXMP-0000-000F",
      "type": "Scratchpad",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "origin": "<origin>",
      "intent": "<intent>",
      "planRevision": 1,
      "approvedPlanRevision": 1,
      "inFlightSeq": 1,
      "realizationFault": "<realization fault>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

realizeScratchpad

realizeScratchpad — mutation · Execute an approved plan — create its records one step at a time under YOUR OWN permissions.

Example request

mutation ExampleRealizeScratchpad($id: ID!, $revision: ID!, $reason: String) {
  realizeScratchpad(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    origin
    intent
    planRevision
    approvedPlanRevision
    inFlightSeq
    realizationFault
  }
}

Variables:

{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}

Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.

Example response

{
  "data": {
    "realizeScratchpad": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "SD-EXMP-0000-000F",
      "type": "Scratchpad",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "origin": "<origin>",
      "intent": "<intent>",
      "planRevision": 1,
      "approvedPlanRevision": 1,
      "inFlightSeq": 1,
      "realizationFault": "<realization fault>"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}