graphlit-client 1.0.20260301003 → 1.0.20260302001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1008,9 +1008,11 @@ declare class Graphlit {
1008
1008
  * @param includeDetails - Whether to include details, optional.
1009
1009
  * @param correlationId - The tenant correlation identifier, optional.
1010
1010
  * @param persona - The persona to use, optional.
1011
+ * @param instructions - Per-turn instructions to inject into guidance, optional.
1012
+ * @param scratchpad - Per-turn scratchpad text to inject, optional. Merged with conversation scratchpad.
1011
1013
  * @returns The formatted conversation.
1012
1014
  */
1013
- formatConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, tools?: Types.ToolDefinitionInput[], systemPrompt?: string, includeDetails?: boolean, correlationId?: string, persona?: Types.EntityReferenceInput, instructions?: string): Promise<Types.FormatConversationMutation>;
1015
+ formatConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, tools?: Types.ToolDefinitionInput[], systemPrompt?: string, includeDetails?: boolean, correlationId?: string, persona?: Types.EntityReferenceInput, instructions?: string, scratchpad?: string): Promise<Types.FormatConversationMutation>;
1014
1016
  /**
1015
1017
  * Completes a conversation with an external LLM response.
1016
1018
  * @param completion - The completion text from the external LLM.
@@ -1053,9 +1055,11 @@ declare class Graphlit {
1053
1055
  * @param includeDetails - Whether to include details, optional.
1054
1056
  * @param correlationId - The tenant correlation identifier, optional.
1055
1057
  * @param persona - The persona to use, optional.
1058
+ * @param instructions - Per-turn instructions to inject into guidance, optional.
1059
+ * @param scratchpad - Per-turn scratchpad text to inject, optional. Merged with conversation scratchpad.
1056
1060
  * @returns The conversation response.
1057
1061
  */
1058
- promptConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, mimeType?: string, data?: string, tools?: Types.ToolDefinitionInput[], requireTool?: boolean, systemPrompt?: string, includeDetails?: boolean, correlationId?: string, persona?: Types.EntityReferenceInput, instructions?: string): Promise<Types.PromptConversationMutation>;
1062
+ promptConversation(prompt: string, id?: string, specification?: Types.EntityReferenceInput, mimeType?: string, data?: string, tools?: Types.ToolDefinitionInput[], requireTool?: boolean, systemPrompt?: string, includeDetails?: boolean, correlationId?: string, persona?: Types.EntityReferenceInput, instructions?: string, scratchpad?: string): Promise<Types.PromptConversationMutation>;
1059
1063
  /**
1060
1064
  * Continues a conversation with tool responses.
1061
1065
  * @param id - The conversation ID.
package/dist/client.js CHANGED
@@ -1863,9 +1863,11 @@ class Graphlit {
1863
1863
  * @param includeDetails - Whether to include details, optional.
1864
1864
  * @param correlationId - The tenant correlation identifier, optional.
1865
1865
  * @param persona - The persona to use, optional.
1866
+ * @param instructions - Per-turn instructions to inject into guidance, optional.
1867
+ * @param scratchpad - Per-turn scratchpad text to inject, optional. Merged with conversation scratchpad.
1866
1868
  * @returns The formatted conversation.
1867
1869
  */
1868
- async formatConversation(prompt, id, specification, tools, systemPrompt, includeDetails, correlationId, persona, instructions) {
1870
+ async formatConversation(prompt, id, specification, tools, systemPrompt, includeDetails, correlationId, persona, instructions, scratchpad) {
1869
1871
  return this.mutateAndCheckError(Documents.FormatConversation, {
1870
1872
  prompt: prompt,
1871
1873
  id: id,
@@ -1876,6 +1878,7 @@ class Graphlit {
1876
1878
  includeDetails: includeDetails,
1877
1879
  correlationId: correlationId,
1878
1880
  instructions: instructions,
1881
+ scratchpad: scratchpad,
1879
1882
  });
1880
1883
  }
1881
1884
  /**
@@ -1943,9 +1946,11 @@ class Graphlit {
1943
1946
  * @param includeDetails - Whether to include details, optional.
1944
1947
  * @param correlationId - The tenant correlation identifier, optional.
1945
1948
  * @param persona - The persona to use, optional.
1949
+ * @param instructions - Per-turn instructions to inject into guidance, optional.
1950
+ * @param scratchpad - Per-turn scratchpad text to inject, optional. Merged with conversation scratchpad.
1946
1951
  * @returns The conversation response.
1947
1952
  */
1948
- async promptConversation(prompt, id, specification, mimeType, data, tools, requireTool, systemPrompt, includeDetails, correlationId, persona, instructions) {
1953
+ async promptConversation(prompt, id, specification, mimeType, data, tools, requireTool, systemPrompt, includeDetails, correlationId, persona, instructions, scratchpad) {
1949
1954
  return this.mutateAndCheckError(Documents.PromptConversation, {
1950
1955
  prompt: prompt,
1951
1956
  id: id,
@@ -1959,6 +1964,7 @@ class Graphlit {
1959
1964
  includeDetails: includeDetails,
1960
1965
  correlationId: correlationId,
1961
1966
  instructions: instructions,
1967
+ scratchpad: scratchpad,
1962
1968
  });
1963
1969
  }
1964
1970
  /**
@@ -5075,7 +5081,7 @@ class Graphlit {
5075
5081
  });
5076
5082
  // Start the streaming conversation
5077
5083
  // fullSpec is guaranteed non-null here — the !fullSpec check above returns early
5078
- await this.executeStreamingAgent(prompt, actualConversationId, fullSpec, tools, toolHandlers, uiAdapter, maxRounds, abortSignal, mimeType, data, correlationId, persona, options?.contextStrategy, options?.instructions);
5084
+ await this.executeStreamingAgent(prompt, actualConversationId, fullSpec, tools, toolHandlers, uiAdapter, maxRounds, abortSignal, mimeType, data, correlationId, persona, options?.contextStrategy, options?.instructions, options?.scratchpad);
5079
5085
  }, abortSignal);
5080
5086
  }
5081
5087
  catch (error) {
@@ -5121,7 +5127,7 @@ class Graphlit {
5121
5127
  /**
5122
5128
  * Execute the streaming agent workflow with tool calling loop
5123
5129
  */
5124
- async executeStreamingAgent(prompt, conversationId, specification, tools, toolHandlers, uiAdapter, maxRounds, abortSignal, mimeType, data, correlationId, persona, contextStrategy, instructions) {
5130
+ async executeStreamingAgent(prompt, conversationId, specification, tools, toolHandlers, uiAdapter, maxRounds, abortSignal, mimeType, data, correlationId, persona, contextStrategy, instructions, scratchpad) {
5125
5131
  // Collects artifact content IDs from tool handlers (e.g. code_execution).
5126
5132
  // Handlers register async ingestion promises; we await all of them before
5127
5133
  // completeConversation so the IDs are available without blocking the LLM.
@@ -5141,7 +5147,7 @@ class Graphlit {
5141
5147
  conversationId,
5142
5148
  });
5143
5149
  // Format conversation once at the beginning
5144
- const formatResponse = await this.formatConversation(prompt, conversationId, { id: specification.id }, tools, undefined, true, correlationId, persona, instructions);
5150
+ const formatResponse = await this.formatConversation(prompt, conversationId, { id: specification.id }, tools, undefined, true, correlationId, persona, instructions, scratchpad);
5145
5151
  const formattedMessage = formatResponse.formatConversation?.message;
5146
5152
  const conversationHistory = formatResponse.formatConversation?.details?.messages;
5147
5153
  if (!formattedMessage?.message) {
@@ -5952,6 +5958,7 @@ class Graphlit {
5952
5958
  // Resolve or create Agent entity
5953
5959
  let agentSpec = specification;
5954
5960
  let agentFilter;
5961
+ let agentScratchpad;
5955
5962
  if (agentId) {
5956
5963
  const agentResponse = await this.getAgent(agentId, options?.correlationId);
5957
5964
  const agent = agentResponse.agent;
@@ -5968,6 +5975,9 @@ class Graphlit {
5968
5975
  if (agent.filter) {
5969
5976
  agentFilter = agent.filter;
5970
5977
  }
5978
+ if (agent.scratchpad) {
5979
+ agentScratchpad = agent.scratchpad;
5980
+ }
5971
5981
  }
5972
5982
  else {
5973
5983
  // Create ephemeral agent
@@ -6134,7 +6144,7 @@ class Graphlit {
6134
6144
  }
6135
6145
  else {
6136
6146
  // Formatted path: call formatConversation
6137
- const formatResponse = await this.formatConversation(turn === 0 ? prompt : "Continue.", conversationId, agentSpec, allTools, undefined, true, options?.correlationId, options?.persona, turnInstructions);
6147
+ const formatResponse = await this.formatConversation(turn === 0 ? prompt : "Continue.", conversationId, agentSpec, allTools, undefined, true, options?.correlationId, options?.persona, turnInstructions, agentScratchpad);
6138
6148
  const formattedMessage = formatResponse.formatConversation?.message;
6139
6149
  const conversationHistory = formatResponse.formatConversation?.details?.messages;
6140
6150
  const formatDetails = formatResponse.formatConversation?.details;
@@ -177,6 +177,7 @@ export const GetAgent = gql `
177
177
  timeZoneId
178
178
  }
179
179
  timeout
180
+ scratchpad
180
181
  }
181
182
  }
182
183
  `;
@@ -299,6 +300,7 @@ export const QueryAgents = gql `
299
300
  timeZoneId
300
301
  }
301
302
  timeout
303
+ scratchpad
302
304
  }
303
305
  }
304
306
  }
@@ -4825,6 +4827,7 @@ export const CompleteConversation = gql `
4825
4827
  formattedSources
4826
4828
  formattedObservables
4827
4829
  formattedInstructions
4830
+ formattedScratchpad
4828
4831
  formattedTools
4829
4832
  formattedPersona
4830
4833
  specification
@@ -5172,6 +5175,7 @@ export const ContinueConversation = gql `
5172
5175
  formattedSources
5173
5176
  formattedObservables
5174
5177
  formattedInstructions
5178
+ formattedScratchpad
5175
5179
  formattedTools
5176
5180
  formattedPersona
5177
5181
  specification
@@ -5365,7 +5369,7 @@ export const DeleteConversations = gql `
5365
5369
  }
5366
5370
  `;
5367
5371
  export const FormatConversation = gql `
5368
- mutation FormatConversation($prompt: String!, $id: ID, $specification: EntityReferenceInput, $persona: EntityReferenceInput, $tools: [ToolDefinitionInput!], $systemPrompt: String, $includeDetails: Boolean, $correlationId: String, $instructions: String) {
5372
+ mutation FormatConversation($prompt: String!, $id: ID, $specification: EntityReferenceInput, $persona: EntityReferenceInput, $tools: [ToolDefinitionInput!], $systemPrompt: String, $includeDetails: Boolean, $correlationId: String, $instructions: String, $scratchpad: String) {
5369
5373
  formatConversation(
5370
5374
  prompt: $prompt
5371
5375
  id: $id
@@ -5376,6 +5380,7 @@ export const FormatConversation = gql `
5376
5380
  includeDetails: $includeDetails
5377
5381
  correlationId: $correlationId
5378
5382
  instructions: $instructions
5383
+ scratchpad: $scratchpad
5379
5384
  ) {
5380
5385
  conversation {
5381
5386
  id
@@ -5570,6 +5575,7 @@ export const FormatConversation = gql `
5570
5575
  formattedSources
5571
5576
  formattedObservables
5572
5577
  formattedInstructions
5578
+ formattedScratchpad
5573
5579
  formattedTools
5574
5580
  formattedPersona
5575
5581
  specification
@@ -6290,7 +6296,7 @@ export const Prompt = gql `
6290
6296
  }
6291
6297
  `;
6292
6298
  export const PromptConversation = gql `
6293
- mutation PromptConversation($prompt: String!, $mimeType: String, $data: String, $id: ID, $specification: EntityReferenceInput, $persona: EntityReferenceInput, $systemPrompt: String, $tools: [ToolDefinitionInput!], $requireTool: Boolean, $includeDetails: Boolean, $correlationId: String, $instructions: String) {
6299
+ mutation PromptConversation($prompt: String!, $mimeType: String, $data: String, $id: ID, $specification: EntityReferenceInput, $persona: EntityReferenceInput, $systemPrompt: String, $tools: [ToolDefinitionInput!], $requireTool: Boolean, $includeDetails: Boolean, $correlationId: String, $instructions: String, $scratchpad: String) {
6294
6300
  promptConversation(
6295
6301
  prompt: $prompt
6296
6302
  id: $id
@@ -6304,6 +6310,7 @@ export const PromptConversation = gql `
6304
6310
  includeDetails: $includeDetails
6305
6311
  correlationId: $correlationId
6306
6312
  instructions: $instructions
6313
+ scratchpad: $scratchpad
6307
6314
  ) {
6308
6315
  conversation {
6309
6316
  id
@@ -6498,6 +6505,7 @@ export const PromptConversation = gql `
6498
6505
  formattedSources
6499
6506
  formattedObservables
6500
6507
  formattedInstructions
6508
+ formattedScratchpad
6501
6509
  formattedTools
6502
6510
  formattedPersona
6503
6511
  specification
@@ -131,6 +131,8 @@ export type Agent = {
131
131
  relevance?: Maybe<Scalars['Float']['output']>;
132
132
  /** The agent schedule policy. */
133
133
  schedulePolicy?: Maybe<AgentSchedulePolicy>;
134
+ /** The agent scratchpad, for storing harness working memory. */
135
+ scratchpad?: Maybe<Scalars['String']['output']>;
134
136
  /** The specification associated with this agent. */
135
137
  specification?: Maybe<EntityReference>;
136
138
  /** The state of the agent (i.e. created, finished). */
@@ -183,6 +185,8 @@ export type AgentInput = {
183
185
  name: Scalars['String']['input'];
184
186
  /** The agent schedule policy. */
185
187
  schedulePolicy?: InputMaybe<AgentSchedulePolicyInput>;
188
+ /** The agent scratchpad, for storing harness working memory. */
189
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
186
190
  /** The specification associated with this agent. */
187
191
  specification?: InputMaybe<EntityReferenceInput>;
188
192
  /** The agent timeout. */
@@ -236,6 +240,8 @@ export type AgentUpdateInput = {
236
240
  name?: InputMaybe<Scalars['String']['input']>;
237
241
  /** The agent schedule policy. */
238
242
  schedulePolicy?: InputMaybe<AgentSchedulePolicyInput>;
243
+ /** The agent scratchpad, for storing harness working memory. */
244
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
239
245
  /** The specification associated with this agent. */
240
246
  specification?: InputMaybe<EntityReferenceInput>;
241
247
  /** The agent timeout. */
@@ -3705,6 +3711,8 @@ export type Conversation = {
3705
3711
  persona?: Maybe<Persona>;
3706
3712
  /** The relevance score of the conversation. */
3707
3713
  relevance?: Maybe<Scalars['Float']['output']>;
3714
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
3715
+ scratchpad?: Maybe<Scalars['String']['output']>;
3708
3716
  /** The LLM specification used by this conversation. */
3709
3717
  specification?: Maybe<Specification>;
3710
3718
  /** The state of the conversation (i.e. created, finished). */
@@ -3747,6 +3755,8 @@ export type ConversationDetails = {
3747
3755
  formattedObservables?: Maybe<Scalars['String']['output']>;
3748
3756
  /** The formatted persona prompt. */
3749
3757
  formattedPersona?: Maybe<Scalars['String']['output']>;
3758
+ /** The formatted scratchpad. */
3759
+ formattedScratchpad?: Maybe<Scalars['String']['output']>;
3750
3760
  /** The formatted sources. */
3751
3761
  formattedSources?: Maybe<Scalars['String']['output']>;
3752
3762
  /** The formatted LLM tools. */
@@ -3858,6 +3868,8 @@ export type ConversationInput = {
3858
3868
  name: Scalars['String']['input'];
3859
3869
  /** The persona used by this conversation, optional. */
3860
3870
  persona?: InputMaybe<EntityReferenceInput>;
3871
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
3872
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
3861
3873
  /** The LLM specification used by this conversation, optional. */
3862
3874
  specification?: InputMaybe<EntityReferenceInput>;
3863
3875
  /** The tool calling definitions. */
@@ -4160,6 +4172,8 @@ export type ConversationUpdateInput = {
4160
4172
  name?: InputMaybe<Scalars['String']['input']>;
4161
4173
  /** The persona used by this conversation, optional. */
4162
4174
  persona?: InputMaybe<EntityReferenceInput>;
4175
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
4176
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
4163
4177
  /** The LLM specification used by this conversation, optional. */
4164
4178
  specification?: InputMaybe<EntityReferenceInput>;
4165
4179
  /** The tool calling definitions. */
@@ -15039,6 +15053,7 @@ export type MutationFormatConversationArgs = {
15039
15053
  instructions?: InputMaybe<Scalars['String']['input']>;
15040
15054
  persona?: InputMaybe<EntityReferenceInput>;
15041
15055
  prompt: Scalars['String']['input'];
15056
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
15042
15057
  specification?: InputMaybe<EntityReferenceInput>;
15043
15058
  systemPrompt?: InputMaybe<Scalars['String']['input']>;
15044
15059
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
@@ -15166,6 +15181,7 @@ export type MutationPromptConversationArgs = {
15166
15181
  persona?: InputMaybe<EntityReferenceInput>;
15167
15182
  prompt: Scalars['String']['input'];
15168
15183
  requireTool?: InputMaybe<Scalars['Boolean']['input']>;
15184
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
15169
15185
  specification?: InputMaybe<EntityReferenceInput>;
15170
15186
  systemPrompt?: InputMaybe<Scalars['String']['input']>;
15171
15187
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
@@ -22775,6 +22791,7 @@ export type GetAgentQuery = {
22775
22791
  correlationId?: string | null;
22776
22792
  type: AgentTypes;
22777
22793
  timeout?: any | null;
22794
+ scratchpad?: string | null;
22778
22795
  owner: {
22779
22796
  __typename?: 'Owner';
22780
22797
  id: string;
@@ -22931,6 +22948,7 @@ export type QueryAgentsQuery = {
22931
22948
  correlationId?: string | null;
22932
22949
  type: AgentTypes;
22933
22950
  timeout?: any | null;
22951
+ scratchpad?: string | null;
22934
22952
  owner: {
22935
22953
  __typename?: 'Owner';
22936
22954
  id: string;
@@ -28306,6 +28324,7 @@ export type CompleteConversationMutation = {
28306
28324
  formattedSources?: string | null;
28307
28325
  formattedObservables?: string | null;
28308
28326
  formattedInstructions?: string | null;
28327
+ formattedScratchpad?: string | null;
28309
28328
  formattedTools?: string | null;
28310
28329
  formattedPersona?: string | null;
28311
28330
  specification?: string | null;
@@ -28681,6 +28700,7 @@ export type ContinueConversationMutation = {
28681
28700
  formattedSources?: string | null;
28682
28701
  formattedObservables?: string | null;
28683
28702
  formattedInstructions?: string | null;
28703
+ formattedScratchpad?: string | null;
28684
28704
  formattedTools?: string | null;
28685
28705
  formattedPersona?: string | null;
28686
28706
  specification?: string | null;
@@ -28907,6 +28927,7 @@ export type FormatConversationMutationVariables = Exact<{
28907
28927
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
28908
28928
  correlationId?: InputMaybe<Scalars['String']['input']>;
28909
28929
  instructions?: InputMaybe<Scalars['String']['input']>;
28930
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
28910
28931
  }>;
28911
28932
  export type FormatConversationMutation = {
28912
28933
  __typename?: 'Mutation';
@@ -29123,6 +29144,7 @@ export type FormatConversationMutation = {
29123
29144
  formattedSources?: string | null;
29124
29145
  formattedObservables?: string | null;
29125
29146
  formattedInstructions?: string | null;
29147
+ formattedScratchpad?: string | null;
29126
29148
  formattedTools?: string | null;
29127
29149
  formattedPersona?: string | null;
29128
29150
  specification?: string | null;
@@ -29952,6 +29974,7 @@ export type PromptConversationMutationVariables = Exact<{
29952
29974
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
29953
29975
  correlationId?: InputMaybe<Scalars['String']['input']>;
29954
29976
  instructions?: InputMaybe<Scalars['String']['input']>;
29977
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
29955
29978
  }>;
29956
29979
  export type PromptConversationMutation = {
29957
29980
  __typename?: 'Mutation';
@@ -30168,6 +30191,7 @@ export type PromptConversationMutation = {
30168
30191
  formattedSources?: string | null;
30169
30192
  formattedObservables?: string | null;
30170
30193
  formattedInstructions?: string | null;
30194
+ formattedScratchpad?: string | null;
30171
30195
  formattedTools?: string | null;
30172
30196
  formattedPersona?: string | null;
30173
30197
  specification?: string | null;
@@ -68,6 +68,8 @@ export interface StreamAgentOptions {
68
68
  contextStrategy?: ContextStrategy;
69
69
  /** Harness-injected instructions appended to the formatted conversation (e.g. wind-down, stuck intervention). */
70
70
  instructions?: string;
71
+ /** Harness-injected scratchpad text, merged with conversation scratchpad. Placed right before user-prompt. */
72
+ scratchpad?: string;
71
73
  }
72
74
  export interface ToolCallResult {
73
75
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphlit-client",
3
- "version": "1.0.20260301003",
3
+ "version": "1.0.20260302001",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",