@harness-gw/sdk 0.10.4 → 0.11.0

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/README.md CHANGED
@@ -63,7 +63,7 @@ You need a running harness. Hermes is the primary one; see
63
63
  docker run --rm \
64
64
  -v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
65
65
  -v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
66
- ghcr.io/almogbaku/harness-gw:0.10.4 \
66
+ ghcr.io/almogbaku/harness-gw:0.11.0 \
67
67
  config check --config /run/harness-gw/config.yaml
68
68
  ```
69
69
 
@@ -73,7 +73,7 @@ You need a running harness. Hermes is the primary one; see
73
73
  docker run --rm -p 127.0.0.1:4100:4100 \
74
74
  -v "$PWD/config.yaml:/run/harness-gw/config.yaml:ro" \
75
75
  -v "$PWD/hermes-token:/run/secrets/hermes-token:ro" \
76
- ghcr.io/almogbaku/harness-gw:0.10.4 \
76
+ ghcr.io/almogbaku/harness-gw:0.11.0 \
77
77
  serve --config /run/harness-gw/config.yaml
78
78
  ```
79
79
 
@@ -9,6 +9,7 @@ var IdentifierSchema = z.string().min(1).max(256).refine((value) => [...value].e
9
9
  return code >= 32 && code !== 127;
10
10
  }));
11
11
  var Utf8MiBTextSchema = z.string().min(1).refine((value) => new TextEncoder().encode(value).byteLength <= 1048576);
12
+ var JsonRecordSchema = z.record(z.string(), z.json());
12
13
  var RuntimeAuthStateSchema2 = z.discriminatedUnion("status", [
13
14
  z.strictObject({ status: z.literal("authenticated") }),
14
15
  z.strictObject({ status: z.literal("authentication-required") }),
@@ -83,9 +84,9 @@ var AgentSummarySchema = z.strictObject({
83
84
  status: z.enum(["idle", "active", "running", "attention", "unknown"]).optional(),
84
85
  activity: z.enum(["active", "idle", "unknown"]).optional(),
85
86
  visibility: z.enum(["visible", "hidden"]).optional(),
86
- role: z.literal("creator").optional(),
87
87
  avatar: AgentAvatarSchema2.optional(),
88
- muted: z.literal(true).optional()
88
+ muted: z.literal(true).optional(),
89
+ _meta: JsonRecordSchema.optional()
89
90
  });
90
91
  var AgentCatalogEntrySchema2 = z.strictObject({
91
92
  summary: AgentSummarySchema,
@@ -199,7 +200,6 @@ var ToolDiffSchema2 = z.strictObject({
199
200
  changes: z.array(DiffChangeSchema2).min(1),
200
201
  patch: z.string().optional()
201
202
  });
202
- var JsonRecordSchema = z.record(z.string(), z.json());
203
203
  var SessionMessagePartSchema = z.discriminatedUnion("type", [
204
204
  z.strictObject({ type: z.literal("text"), text: z.string().max(1e6) }),
205
205
  z.strictObject({
@@ -735,7 +735,7 @@ function hgwAcpAgentPath2(agentId) {
735
735
  return `${HGW_ACP_AGENTS_PATH2}/${encodeURIComponent(agentId)}`;
736
736
  }
737
737
  var HGW_META_KEY2 = "hgw";
738
- var HGW_EXTENSION_VERSION2 = 2;
738
+ var HGW_EXTENSION_VERSION2 = 3;
739
739
  var HGW_AUTH_METHOD_INVITE2 = "hgw-invite";
740
740
  var HGW_ATTACHMENT_URI_SCHEME2 = "hgw-attachment:";
741
741
  var HGW_ARTIFACT_URI_SCHEME2 = "artifact:";
@@ -1053,10 +1053,8 @@ function categoryOf2(type) {
1053
1053
  case "attention-requested":
1054
1054
  return "input";
1055
1055
  case "turn-failed":
1056
- case "agent-activation-failed":
1057
1056
  return "failure";
1058
1057
  case "turn-finished":
1059
- case "agent-ready":
1060
1058
  return "completion";
1061
1059
  default:
1062
1060
  return;
@@ -12,12 +12,10 @@ type MetadataListener = (metadata: SessionMetadata[]) => void;
12
12
  export type AcpSessionStoreOptions = {
13
13
  connection: AcpConnection;
14
14
  now?: () => number;
15
- /** A live turn of a subscribed Session just stopped, however it ended. */
16
- onTurnFinished?: (sessionId: string) => void;
17
15
  /** Where a listener that throws is told; the others still hear. */
18
16
  logger?: Logger;
19
17
  };
20
- export declare function createAcpSessionStore({ connection, now, onTurnFinished, logger, }: AcpSessionStoreOptions): {
18
+ export declare function createAcpSessionStore({ connection, now, logger, }: AcpSessionStoreOptions): {
21
19
  subscribe: (sessionId: string, agentId?: string) => () => void;
22
20
  dispose(): void;
23
21
  /**
@@ -59,7 +57,6 @@ export declare function createAcpSessionStore({ connection, now, onTurnFinished,
59
57
  subscribeMetadata(sessionIds: readonly string[], listener: MetadataListener): () => boolean;
60
58
  subscribeStatus(sessionId: string, listener: () => void): () => boolean;
61
59
  subscribeTodos(sessionId: string, listener: (todos: TodoItem[]) => void): () => void;
62
- emitActivity: (event: WorkspaceActivityEvent) => void;
63
60
  subscribeActivity(listener: (event: WorkspaceActivityEvent) => void): () => boolean;
64
61
  subscribeInvalidation(sessionId: string, listener: () => void): () => void;
65
62
  };
@@ -26,9 +26,9 @@ export declare function createAcpWorkspaceClient({ connection, rest, agentIdFor,
26
26
  status?: "active" | "attention" | "idle" | "running" | "unknown" | undefined;
27
27
  activity?: "active" | "idle" | "unknown" | undefined;
28
28
  visibility?: "hidden" | "visible" | undefined;
29
- role?: "creator" | undefined;
30
29
  avatar?: string | undefined;
31
30
  muted?: true | undefined;
31
+ _meta?: Record<string, import("zod").JSONType> | undefined;
32
32
  }[]>;
33
33
  refreshAgents(): Promise<{
34
34
  kind: "ready";
@@ -38,9 +38,9 @@ export declare function createAcpWorkspaceClient({ connection, rest, agentIdFor,
38
38
  status?: "active" | "attention" | "idle" | "running" | "unknown" | undefined;
39
39
  activity?: "active" | "idle" | "unknown" | undefined;
40
40
  visibility?: "hidden" | "visible" | undefined;
41
- role?: "creator" | undefined;
42
41
  avatar?: string | undefined;
43
42
  muted?: true | undefined;
43
+ _meta?: Record<string, import("zod").JSONType> | undefined;
44
44
  }[]>;
45
45
  listAgentCatalog(): Promise<{
46
46
  summary: {
@@ -51,9 +51,9 @@ export declare function createAcpWorkspaceClient({ connection, rest, agentIdFor,
51
51
  status?: "active" | "attention" | "idle" | "running" | "unknown" | undefined;
52
52
  activity?: "active" | "idle" | "unknown" | undefined;
53
53
  visibility?: "hidden" | "visible" | undefined;
54
- role?: "creator" | undefined;
55
54
  avatar?: string | undefined;
56
55
  muted?: true | undefined;
56
+ _meta?: Record<string, import("zod").JSONType> | undefined;
57
57
  };
58
58
  visibility: "hidden" | "visible";
59
59
  selectable: boolean;
@@ -1690,7 +1690,6 @@ function sameRow(left, right) {
1690
1690
  function createAcpSessionStore({
1691
1691
  connection,
1692
1692
  now = Date.now,
1693
- onTurnFinished,
1694
1693
  logger = SILENT_LOGGER
1695
1694
  }) {
1696
1695
  const rows = new Map;
@@ -1770,10 +1769,7 @@ function createAcpSessionStore({
1770
1769
  const status = statusFromState(update);
1771
1770
  if (replaying.has(sessionId))
1772
1771
  return void replaying.set(sessionId, status);
1773
- const previous = rows.get(sessionId)?.status;
1774
1772
  patch(sessionId, { status });
1775
- if ((previous === "running" || previous === "waiting-for-input") && (status === "idle" || status === "failed"))
1776
- onTurnFinished?.(sessionId);
1777
1773
  return;
1778
1774
  }
1779
1775
  if (SessionUpdate3.isSessionInfoUpdate(update)) {
@@ -1904,7 +1900,6 @@ function createAcpSessionStore({
1904
1900
  todoListeners.delete(sessionId);
1905
1901
  };
1906
1902
  },
1907
- emitActivity,
1908
1903
  subscribeActivity(listener) {
1909
1904
  activityListeners.add(listener);
1910
1905
  return () => activityListeners.delete(listener);
@@ -1947,10 +1942,7 @@ function createAcpWorkspaceClient({
1947
1942
  const store = createAcpSessionStore({
1948
1943
  connection,
1949
1944
  logger: clientLog,
1950
- ...now ? { now } : {},
1951
- onTurnFinished: (sessionId) => {
1952
- reportCreatedAgents(sessionId).catch((err) => clientLog.warn({ err }, "agent.report_created_failed"));
1953
- }
1945
+ ...now ? { now } : {}
1954
1946
  });
1955
1947
  const composer = createAcpComposerStore(connection);
1956
1948
  const revisions = new Map;
@@ -1961,9 +1953,6 @@ function createAcpWorkspaceClient({
1961
1953
  const result = await connection.updateAgent({ agentId, ...patch, revision });
1962
1954
  revisions.set(agentId, result.agent.revision);
1963
1955
  }
1964
- let creatorId;
1965
- let listedAgentIds = new Set;
1966
- const creatorBaselines = new Map;
1967
1956
  let sessionActions;
1968
1957
  function adopt(sessionId, agentId) {
1969
1958
  try {
@@ -1988,8 +1977,6 @@ function createAcpWorkspaceClient({
1988
1977
  revisions.clear();
1989
1978
  for (const entry of response.agents)
1990
1979
  revisions.set(entry.summary.id, entry.revision);
1991
- creatorId = response.agents.find(({ summary }) => summary.role === "creator")?.summary.id;
1992
- listedAgentIds = new Set(response.agents.map(({ summary }) => summary.id));
1993
1980
  return response;
1994
1981
  }
1995
1982
  function rememberRows(sessions) {
@@ -2024,33 +2011,6 @@ function createAcpWorkspaceClient({
2024
2011
  pageReads.set(key, read);
2025
2012
  return read;
2026
2013
  }
2027
- function watchCreator(sessionId, agentId) {
2028
- if (agentId === creatorId && !creatorBaselines.has(sessionId))
2029
- creatorBaselines.set(sessionId, new Set(listedAgentIds));
2030
- }
2031
- async function reportCreatedAgents(sessionId) {
2032
- const baseline = creatorBaselines.get(sessionId);
2033
- if (!baseline)
2034
- return;
2035
- let agents;
2036
- try {
2037
- agents = (await catalog()).agents;
2038
- } catch {
2039
- return;
2040
- }
2041
- for (const { summary, visibility } of agents) {
2042
- if (baseline.has(summary.id))
2043
- continue;
2044
- baseline.add(summary.id);
2045
- store.emitActivity({
2046
- id: `${sessionId}:${summary.id}`,
2047
- type: visibility === "hidden" ? "agent-activation-failed" : "agent-ready",
2048
- agentId: summary.id,
2049
- sessionId,
2050
- occurredAt: new Date((now ?? Date.now)()).toISOString()
2051
- });
2052
- }
2053
- }
2054
2014
  async function listSessions(agentId, cursor) {
2055
2015
  const page = await readSessionPage(agentId === undefined ? {} : { agentId }, cursor);
2056
2016
  return {
@@ -2144,10 +2104,8 @@ function createAcpWorkspaceClient({
2144
2104
  leaveComposer();
2145
2105
  }
2146
2106
  });
2147
- if (agentId) {
2107
+ if (agentId)
2148
2108
  adopt(sessionId, agentId);
2149
- watchCreator(sessionId, agentId);
2150
- }
2151
2109
  }
2152
2110
  let released = false;
2153
2111
  return () => {
@@ -2224,7 +2182,6 @@ function createAcpWorkspaceClient({
2224
2182
  ...options?.title ? { title: options.title } : {}
2225
2183
  });
2226
2184
  adopt(created.sessionId, agentId);
2227
- watchCreator(created.sessionId, agentId);
2228
2185
  return { sessionId: created.sessionId };
2229
2186
  },
2230
2187
  subscribeSession,
@@ -52,8 +52,6 @@ export type WorkspaceActivityEvent = (ActivityBase & {
52
52
  }) | (ActivityBase & {
53
53
  type: "attention-resolved";
54
54
  requestId: string;
55
- }) | (ActivityBase & {
56
- type: "agent-ready" | "agent-activation-failed";
57
55
  });
58
56
  export type SessionMetadata = {
59
57
  sessionId: string;
@@ -44,7 +44,7 @@ export declare const HGW_ACP_AGENTS_PATH: "/api/v1/acp/agents";
44
44
  /** One Agent's own ACP address, its id one path segment. */
45
45
  export declare function hgwAcpAgentPath(agentId: string): string;
46
46
  export declare const HGW_META_KEY: "hgw";
47
- export declare const HGW_EXTENSION_VERSION: 2;
47
+ export declare const HGW_EXTENSION_VERSION: 3;
48
48
  export declare const HGW_AUTH_METHOD_INVITE: "hgw-invite";
49
49
  export declare const HGW_ATTACHMENT_URI_SCHEME: "hgw-attachment:";
50
50
  export declare const HGW_ARTIFACT_URI_SCHEME: "artifact:";
@@ -120,7 +120,7 @@ export declare const HgwClientCapabilitiesMetaSchema: z.ZodObject<{
120
120
  }, z.core.$strip>;
121
121
  /** `InitializeResponse._meta.hgw` */
122
122
  export declare const HgwInitializeMetaSchema: z.ZodObject<{
123
- version: z.ZodLiteral<2>;
123
+ version: z.ZodLiteral<3>;
124
124
  role: z.ZodEnum<{
125
125
  guest: "guest";
126
126
  operator: "operator";
@@ -349,9 +349,9 @@ export declare const HgwAgentsListResponseSchema: z.ZodObject<{
349
349
  hidden: "hidden";
350
350
  visible: "visible";
351
351
  }>>;
352
- role: z.ZodOptional<z.ZodLiteral<"creator">>;
353
352
  avatar: z.ZodOptional<z.ZodString>;
354
353
  muted: z.ZodOptional<z.ZodLiteral<true>>;
354
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
355
355
  }, z.core.$strict>;
356
356
  visibility: z.ZodEnum<{
357
357
  hidden: "hidden";
@@ -400,9 +400,9 @@ export declare const HgwAgentUpdateResponseSchema: z.ZodObject<{
400
400
  hidden: "hidden";
401
401
  visible: "visible";
402
402
  }>>;
403
- role: z.ZodOptional<z.ZodLiteral<"creator">>;
404
403
  avatar: z.ZodOptional<z.ZodString>;
405
404
  muted: z.ZodOptional<z.ZodLiteral<true>>;
405
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
406
406
  }, z.core.$strict>;
407
407
  visibility: z.ZodEnum<{
408
408
  hidden: "hidden";
@@ -164,9 +164,9 @@ export declare const AgentCatalogEntrySchema: z.ZodObject<{
164
164
  hidden: "hidden";
165
165
  visible: "visible";
166
166
  }>>;
167
- role: z.ZodOptional<z.ZodLiteral<"creator">>;
168
167
  avatar: z.ZodOptional<z.ZodString>;
169
168
  muted: z.ZodOptional<z.ZodLiteral<true>>;
169
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
170
170
  }, z.core.$strict>;
171
171
  visibility: z.ZodEnum<{
172
172
  hidden: "hidden";
@@ -203,9 +203,9 @@ export declare const AgentCatalogResponseSchema: z.ZodObject<{
203
203
  hidden: "hidden";
204
204
  visible: "visible";
205
205
  }>>;
206
- role: z.ZodOptional<z.ZodLiteral<"creator">>;
207
206
  avatar: z.ZodOptional<z.ZodString>;
208
207
  muted: z.ZodOptional<z.ZodLiteral<true>>;
208
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
209
209
  }, z.core.$strict>;
210
210
  visibility: z.ZodEnum<{
211
211
  hidden: "hidden";
@@ -272,9 +272,9 @@ export declare const AgentUpdateResponseSchema: z.ZodObject<{
272
272
  hidden: "hidden";
273
273
  visible: "visible";
274
274
  }>>;
275
- role: z.ZodOptional<z.ZodLiteral<"creator">>;
276
275
  avatar: z.ZodOptional<z.ZodString>;
277
276
  muted: z.ZodOptional<z.ZodLiteral<true>>;
277
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
278
278
  }, z.core.$strict>;
279
279
  visibility: z.ZodEnum<{
280
280
  hidden: "hidden";
@@ -14,7 +14,7 @@ export declare const PushCategorySchema: z.ZodEnum<{
14
14
  input: "input";
15
15
  }>;
16
16
  export type PushCategory = z.infer<typeof PushCategorySchema>;
17
- /** Which category, if any, an execution or Agent lifecycle event notifies as. */
17
+ /** Which category, if any, an execution event notifies as. */
18
18
  export declare function categoryOf(type: string): PushCategory | undefined;
19
19
  export declare const PushLocaleSchema: z.ZodEnum<{
20
20
  en: "en";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harness-gw/sdk",
3
- "version": "0.10.4",
3
+ "version": "0.11.0",
4
4
  "description": "A gateway that puts Hermes, OpenClaw, and OpenCode behind one ACP WebSocket, and the browser client and protocol SDK for it.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",