graphlit-client 1.0.20260301004 → 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;
@@ -4827,6 +4827,7 @@ export const CompleteConversation = gql `
4827
4827
  formattedSources
4828
4828
  formattedObservables
4829
4829
  formattedInstructions
4830
+ formattedScratchpad
4830
4831
  formattedTools
4831
4832
  formattedPersona
4832
4833
  specification
@@ -5174,6 +5175,7 @@ export const ContinueConversation = gql `
5174
5175
  formattedSources
5175
5176
  formattedObservables
5176
5177
  formattedInstructions
5178
+ formattedScratchpad
5177
5179
  formattedTools
5178
5180
  formattedPersona
5179
5181
  specification
@@ -5367,7 +5369,7 @@ export const DeleteConversations = gql `
5367
5369
  }
5368
5370
  `;
5369
5371
  export const FormatConversation = gql `
5370
- 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) {
5371
5373
  formatConversation(
5372
5374
  prompt: $prompt
5373
5375
  id: $id
@@ -5378,6 +5380,7 @@ export const FormatConversation = gql `
5378
5380
  includeDetails: $includeDetails
5379
5381
  correlationId: $correlationId
5380
5382
  instructions: $instructions
5383
+ scratchpad: $scratchpad
5381
5384
  ) {
5382
5385
  conversation {
5383
5386
  id
@@ -5572,6 +5575,7 @@ export const FormatConversation = gql `
5572
5575
  formattedSources
5573
5576
  formattedObservables
5574
5577
  formattedInstructions
5578
+ formattedScratchpad
5575
5579
  formattedTools
5576
5580
  formattedPersona
5577
5581
  specification
@@ -6292,7 +6296,7 @@ export const Prompt = gql `
6292
6296
  }
6293
6297
  `;
6294
6298
  export const PromptConversation = gql `
6295
- 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) {
6296
6300
  promptConversation(
6297
6301
  prompt: $prompt
6298
6302
  id: $id
@@ -6306,6 +6310,7 @@ export const PromptConversation = gql `
6306
6310
  includeDetails: $includeDetails
6307
6311
  correlationId: $correlationId
6308
6312
  instructions: $instructions
6313
+ scratchpad: $scratchpad
6309
6314
  ) {
6310
6315
  conversation {
6311
6316
  id
@@ -6500,6 +6505,7 @@ export const PromptConversation = gql `
6500
6505
  formattedSources
6501
6506
  formattedObservables
6502
6507
  formattedInstructions
6508
+ formattedScratchpad
6503
6509
  formattedTools
6504
6510
  formattedPersona
6505
6511
  specification
@@ -3711,6 +3711,8 @@ export type Conversation = {
3711
3711
  persona?: Maybe<Persona>;
3712
3712
  /** The relevance score of the conversation. */
3713
3713
  relevance?: Maybe<Scalars['Float']['output']>;
3714
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
3715
+ scratchpad?: Maybe<Scalars['String']['output']>;
3714
3716
  /** The LLM specification used by this conversation. */
3715
3717
  specification?: Maybe<Specification>;
3716
3718
  /** The state of the conversation (i.e. created, finished). */
@@ -3753,6 +3755,8 @@ export type ConversationDetails = {
3753
3755
  formattedObservables?: Maybe<Scalars['String']['output']>;
3754
3756
  /** The formatted persona prompt. */
3755
3757
  formattedPersona?: Maybe<Scalars['String']['output']>;
3758
+ /** The formatted scratchpad. */
3759
+ formattedScratchpad?: Maybe<Scalars['String']['output']>;
3756
3760
  /** The formatted sources. */
3757
3761
  formattedSources?: Maybe<Scalars['String']['output']>;
3758
3762
  /** The formatted LLM tools. */
@@ -3864,6 +3868,8 @@ export type ConversationInput = {
3864
3868
  name: Scalars['String']['input'];
3865
3869
  /** The persona used by this conversation, optional. */
3866
3870
  persona?: InputMaybe<EntityReferenceInput>;
3871
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
3872
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
3867
3873
  /** The LLM specification used by this conversation, optional. */
3868
3874
  specification?: InputMaybe<EntityReferenceInput>;
3869
3875
  /** The tool calling definitions. */
@@ -4166,6 +4172,8 @@ export type ConversationUpdateInput = {
4166
4172
  name?: InputMaybe<Scalars['String']['input']>;
4167
4173
  /** The persona used by this conversation, optional. */
4168
4174
  persona?: InputMaybe<EntityReferenceInput>;
4175
+ /** The conversation scratchpad, for storing harness working memory as raw text. */
4176
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
4169
4177
  /** The LLM specification used by this conversation, optional. */
4170
4178
  specification?: InputMaybe<EntityReferenceInput>;
4171
4179
  /** The tool calling definitions. */
@@ -15045,6 +15053,7 @@ export type MutationFormatConversationArgs = {
15045
15053
  instructions?: InputMaybe<Scalars['String']['input']>;
15046
15054
  persona?: InputMaybe<EntityReferenceInput>;
15047
15055
  prompt: Scalars['String']['input'];
15056
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
15048
15057
  specification?: InputMaybe<EntityReferenceInput>;
15049
15058
  systemPrompt?: InputMaybe<Scalars['String']['input']>;
15050
15059
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
@@ -15172,6 +15181,7 @@ export type MutationPromptConversationArgs = {
15172
15181
  persona?: InputMaybe<EntityReferenceInput>;
15173
15182
  prompt: Scalars['String']['input'];
15174
15183
  requireTool?: InputMaybe<Scalars['Boolean']['input']>;
15184
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
15175
15185
  specification?: InputMaybe<EntityReferenceInput>;
15176
15186
  systemPrompt?: InputMaybe<Scalars['String']['input']>;
15177
15187
  tools?: InputMaybe<Array<ToolDefinitionInput>>;
@@ -28314,6 +28324,7 @@ export type CompleteConversationMutation = {
28314
28324
  formattedSources?: string | null;
28315
28325
  formattedObservables?: string | null;
28316
28326
  formattedInstructions?: string | null;
28327
+ formattedScratchpad?: string | null;
28317
28328
  formattedTools?: string | null;
28318
28329
  formattedPersona?: string | null;
28319
28330
  specification?: string | null;
@@ -28689,6 +28700,7 @@ export type ContinueConversationMutation = {
28689
28700
  formattedSources?: string | null;
28690
28701
  formattedObservables?: string | null;
28691
28702
  formattedInstructions?: string | null;
28703
+ formattedScratchpad?: string | null;
28692
28704
  formattedTools?: string | null;
28693
28705
  formattedPersona?: string | null;
28694
28706
  specification?: string | null;
@@ -28915,6 +28927,7 @@ export type FormatConversationMutationVariables = Exact<{
28915
28927
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
28916
28928
  correlationId?: InputMaybe<Scalars['String']['input']>;
28917
28929
  instructions?: InputMaybe<Scalars['String']['input']>;
28930
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
28918
28931
  }>;
28919
28932
  export type FormatConversationMutation = {
28920
28933
  __typename?: 'Mutation';
@@ -29131,6 +29144,7 @@ export type FormatConversationMutation = {
29131
29144
  formattedSources?: string | null;
29132
29145
  formattedObservables?: string | null;
29133
29146
  formattedInstructions?: string | null;
29147
+ formattedScratchpad?: string | null;
29134
29148
  formattedTools?: string | null;
29135
29149
  formattedPersona?: string | null;
29136
29150
  specification?: string | null;
@@ -29960,6 +29974,7 @@ export type PromptConversationMutationVariables = Exact<{
29960
29974
  includeDetails?: InputMaybe<Scalars['Boolean']['input']>;
29961
29975
  correlationId?: InputMaybe<Scalars['String']['input']>;
29962
29976
  instructions?: InputMaybe<Scalars['String']['input']>;
29977
+ scratchpad?: InputMaybe<Scalars['String']['input']>;
29963
29978
  }>;
29964
29979
  export type PromptConversationMutation = {
29965
29980
  __typename?: 'Mutation';
@@ -30176,6 +30191,7 @@ export type PromptConversationMutation = {
30176
30191
  formattedSources?: string | null;
30177
30192
  formattedObservables?: string | null;
30178
30193
  formattedInstructions?: string | null;
30194
+ formattedScratchpad?: string | null;
30179
30195
  formattedTools?: string | null;
30180
30196
  formattedPersona?: string | null;
30181
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.20260301004",
3
+ "version": "1.0.20260302001",
4
4
  "description": "Graphlit API Client for TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/client.js",