@ziggs-ai/contracts 0.2.0 → 0.6.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
@@ -16,7 +16,7 @@ import { SERVER_EVENTS, isApiErrorBody } from '@ziggs-ai/contracts';
16
16
  | Module | Carries |
17
17
  | --- | --- |
18
18
  | `chat` | `GET /chats`, `GET /chats/:chatId/messages`, the message write paths |
19
- | `inbox` | `GET /inbox/attention`, `POST /inbox/seen` |
19
+ | `inbox` | Agent request triage, `GET /inbox/attention`, `POST /inbox/seen` |
20
20
  | `error` | the one error body every handler answers in |
21
21
  | `socket` | frame names and payloads, both directions |
22
22
  | `vocabulary` | the closed value lists the above are built from |
@@ -29,3 +29,14 @@ knows exactly which wire it is talking to.
29
29
 
30
30
  The socket is a receive-only accelerator: every frame has an HTTP read that is
31
31
  the source of truth. A client that misses a frame catches up on its next read.
32
+
33
+ ## Releasing
34
+
35
+ Change contract sources and bump `package.json` in the same pull request. CI
36
+ rejects source changes without a newer version. Merging a version bump to main
37
+ publishes that commit automatically after regenerating and checking the wire
38
+ types. A `contracts-v<version>` tag remains available for manual releases.
39
+
40
+ Release contracts before merging client dependency upgrades. Clients can test
41
+ an unreleased version with a local `npm pack` tarball; local validation is not
42
+ a registry publication.
@@ -7,7 +7,10 @@ export type OwnedAgent = {
7
7
  name: string;
8
8
  isDelegate: boolean;
9
9
  connected: boolean;
10
+ engaged: boolean;
10
11
  lastSeenAt: string | null;
12
+ platform: string | null;
13
+ platformLabel: string | null;
11
14
  };
12
15
  export type OwnedAgentsResponse = {
13
16
  agents: Array<OwnedAgent>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * GENERATED from the backend OpenAPI spec — do not edit.
3
+ * Family: artifacts. Regenerate: backend 'pnpm docs:generate' then this script.
4
+ */
5
+ export type ArtifactSenderPersona = {
6
+ id: string;
7
+ name: string;
8
+ image: string | null;
9
+ };
10
+ export type ArtifactSenderPresentation = {
11
+ persona: ArtifactSenderPersona;
12
+ mode: "persona" | "chain";
13
+ };
14
+ export type ArtifactSender = {
15
+ id: string;
16
+ type: "user" | "agent" | "service" | "system";
17
+ presentation?: ArtifactSenderPresentation;
18
+ };
19
+ export type ArtifactLinks = {
20
+ chatIds: Array<string>;
21
+ agreementIds: Array<string>;
22
+ taskIds: Array<string>;
23
+ };
24
+ export type ReachableArtifactEntry = {
25
+ artifactId: string;
26
+ text: string;
27
+ sender: ArtifactSender;
28
+ contentType: string;
29
+ name?: string | null;
30
+ visibility: "chat" | "agent-private";
31
+ timestamp: string;
32
+ service?: unknown;
33
+ linkRole?: "input" | "output";
34
+ reach: Array<"authored" | "chat" | "agreement" | "task" | "grant">;
35
+ links: ArtifactLinks;
36
+ filename?: string | null;
37
+ mime?: string | null;
38
+ byteSize?: number | null;
39
+ checksum?: string | null;
40
+ format?: "pdf" | "docx" | "hwpx" | "md" | "txt" | "html" | null;
41
+ extractionStatus?: "none" | "pending" | "ok" | "failed" | null;
42
+ extractionError?: string | null;
43
+ truncated?: boolean | null;
44
+ extractedArtifactId?: string | null;
45
+ };
46
+ export type ListReachableArtifactsResult = {
47
+ artifacts: Array<ReachableArtifactEntry>;
48
+ latestSequence: string | null;
49
+ truncated: Array<string>;
50
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * GENERATED from the backend OpenAPI spec — do not edit.
3
+ * Family: chatSend. Regenerate: backend 'pnpm docs:generate' then this script.
4
+ */
5
+ export type DailyUsageView = {
6
+ messagesToday: number;
7
+ dailyLimit: number;
8
+ };
9
+ export type SendChatMessageResult = {
10
+ success: boolean;
11
+ message: string;
12
+ messageId: string;
13
+ chatId: string;
14
+ usage?: DailyUsageView;
15
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ /**
2
+ * GENERATED from the backend OpenAPI spec — do not edit.
3
+ * Family: connections. Regenerate: backend 'pnpm docs:generate' then this script.
4
+ */
5
+ export type ConnectionView = {
6
+ connectionId: string;
7
+ ownerId: string;
8
+ provider: string;
9
+ externalAccountLabel?: string | null;
10
+ externalAccountId?: string | null;
11
+ scopesGranted?: Array<string>;
12
+ mcpServerUrl?: string | null;
13
+ status: string;
14
+ createdAt?: string;
15
+ };
16
+ export type ConnectionsListResponse = {
17
+ connections: Array<ConnectionView>;
18
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,43 @@
1
+ /**
2
+ * GENERATED from the backend OpenAPI spec — do not edit.
3
+ * Family: grants. Regenerate: backend 'pnpm docs:generate' then this script.
4
+ */
5
+ export type GrantScopeView = {
6
+ kind: "chat" | "agreement" | "org" | "artifact" | "task" | "connection" | "wallet" | "consent" | "inbox";
7
+ id: string;
8
+ label?: string;
9
+ };
10
+ export type GrantCaveatView = {
11
+ type: string;
12
+ value: unknown;
13
+ };
14
+ export type GrantBasis = {
15
+ kind: "creation" | "publication" | "membership" | "acceptance" | "agreement";
16
+ id: string | null;
17
+ };
18
+ export type GrantView = {
19
+ grantId: string;
20
+ issuerId: string;
21
+ holderId: string;
22
+ parentGrantId: string | null;
23
+ agreementId: string | null;
24
+ scope: GrantScopeView;
25
+ caveats: Array<GrantCaveatView>;
26
+ revoked: boolean;
27
+ expiresAt: string | null;
28
+ createdAt: string;
29
+ health: "active" | "expired" | "revoked";
30
+ holderKind?: "user" | "org" | "agent";
31
+ access?: "read" | "write" | "admit";
32
+ basis?: GrantBasis;
33
+ };
34
+ export type UnreadableRail = {
35
+ rail: string;
36
+ requiredScope: string;
37
+ };
38
+ export type ListGrantsResult = {
39
+ items: Array<GrantView>;
40
+ nextCursor: string | null;
41
+ hasMore: boolean;
42
+ unreadableRails?: Array<UnreadableRail>;
43
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * GENERATED from the backend OpenAPI spec — do not edit.
3
+ * Family: payments. Regenerate: backend 'pnpm docs:generate' then this script.
4
+ */
5
+ export type WalletRef = {
6
+ walletId: string;
7
+ ownerId: string;
8
+ orgId: string | null;
9
+ currency: string;
10
+ status: string;
11
+ };
12
+ export type WalletListEntry = {
13
+ wallet: WalletRef;
14
+ balance: number;
15
+ availableBalance: number;
16
+ orgId: string | null;
17
+ isPrimary: boolean;
18
+ };
19
+ export type WalletsMineResponse = {
20
+ wallets: Array<WalletListEntry>;
21
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /** Wire routing and presentation conventions. These do not confer authority. */
2
+ export declare const AGREEMENT_LANE_PREFIX = "agrn-";
3
+ export declare const PERSONA_FACE_REF_PREFIX = "psn_";
4
+ export declare const ROOM_BINDING_REF_PREFIX = "rpb_";
5
+ export declare function agreementLaneId(agreementId: string): string;
6
+ export declare function agreementIdFromLane(value: unknown): string | undefined;
7
+ export declare function isAgreementLaneId(value: unknown): boolean;
8
+ export declare function isAgreementId(value: unknown): value is string;
9
+ export declare function isPersonaFaceRef(value: unknown): boolean;
10
+ export declare function isRoomBindingRef(value: unknown): boolean;
11
+ export declare function isPresentationRef(value: unknown): boolean;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROOM_BINDING_REF_PREFIX = exports.PERSONA_FACE_REF_PREFIX = exports.AGREEMENT_LANE_PREFIX = void 0;
4
+ exports.agreementLaneId = agreementLaneId;
5
+ exports.agreementIdFromLane = agreementIdFromLane;
6
+ exports.isAgreementLaneId = isAgreementLaneId;
7
+ exports.isAgreementId = isAgreementId;
8
+ exports.isPersonaFaceRef = isPersonaFaceRef;
9
+ exports.isRoomBindingRef = isRoomBindingRef;
10
+ exports.isPresentationRef = isPresentationRef;
11
+ /** Wire routing and presentation conventions. These do not confer authority. */
12
+ exports.AGREEMENT_LANE_PREFIX = 'agrn-';
13
+ exports.PERSONA_FACE_REF_PREFIX = 'psn_';
14
+ exports.ROOM_BINDING_REF_PREFIX = 'rpb_';
15
+ function agreementLaneId(agreementId) {
16
+ return `${exports.AGREEMENT_LANE_PREFIX}${agreementId}`;
17
+ }
18
+ function agreementIdFromLane(value) {
19
+ if (typeof value !== 'string' || !value.startsWith(exports.AGREEMENT_LANE_PREFIX))
20
+ return undefined;
21
+ return value.slice(exports.AGREEMENT_LANE_PREFIX.length) || undefined;
22
+ }
23
+ function isAgreementLaneId(value) {
24
+ return agreementIdFromLane(value) !== undefined;
25
+ }
26
+ function isAgreementId(value) {
27
+ return typeof value === 'string' && value.startsWith('agr_');
28
+ }
29
+ function isPersonaFaceRef(value) {
30
+ return hasPrefix(value, exports.PERSONA_FACE_REF_PREFIX);
31
+ }
32
+ function isRoomBindingRef(value) {
33
+ return hasPrefix(value, exports.ROOM_BINDING_REF_PREFIX);
34
+ }
35
+ function isPresentationRef(value) {
36
+ return isPersonaFaceRef(value) || isRoomBindingRef(value);
37
+ }
38
+ function hasPrefix(value, prefix) {
39
+ return (typeof value === 'string' &&
40
+ value.length > prefix.length &&
41
+ value.startsWith(prefix));
42
+ }
package/dist/inbox.d.ts CHANGED
@@ -154,3 +154,16 @@ export interface AttentionFeed {
154
154
  export interface MarkInboxSeenBody {
155
155
  upTo: string;
156
156
  }
157
+ /** Marketplace request triage channel shared by the server and hosted clients. */
158
+ export interface InboxOpenRequestRef {
159
+ agreementId: string;
160
+ /** Exact-match triage string from the publisher (`metadata.match`). */
161
+ match: string;
162
+ title: string;
163
+ ts: string;
164
+ }
165
+ export interface InboxRequestChannel {
166
+ /** Unacked requests, separated from generic deliveries for exact-match triage. */
167
+ openRequestsAwaitingMe: InboxOpenRequestRef[];
168
+ truncatedRequests: number;
169
+ }
package/dist/index.d.ts CHANGED
@@ -12,3 +12,9 @@ export * from './inbox';
12
12
  export * from './error';
13
13
  export * from './socket';
14
14
  export * from './generated/agents';
15
+ export * from './generated/grants';
16
+ export * from './generated/payments';
17
+ export * from './generated/connections';
18
+ export * from './generated/artifacts';
19
+ export * from './identifiers';
20
+ export * from './generated/chat-send';
package/dist/index.js CHANGED
@@ -29,3 +29,9 @@ __exportStar(require("./error"), exports);
29
29
  __exportStar(require("./socket"), exports);
30
30
  // Generated from the backend OpenAPI spec (ZIG-1668). See scripts/generate-wire.mjs.
31
31
  __exportStar(require("./generated/agents"), exports);
32
+ __exportStar(require("./generated/grants"), exports);
33
+ __exportStar(require("./generated/payments"), exports);
34
+ __exportStar(require("./generated/connections"), exports);
35
+ __exportStar(require("./generated/artifacts"), exports);
36
+ __exportStar(require("./identifiers"), exports);
37
+ __exportStar(require("./generated/chat-send"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziggs-ai/contracts",
3
- "version": "0.2.0",
3
+ "version": "0.6.0",
4
4
  "description": "Wire contracts for the Ziggs API — response shapes, error body, and socket events, shared by every client.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,7 @@
9
9
  "README.md"
10
10
  ],
11
11
  "scripts": {
12
- "build": "node scripts/generate-wire.mjs && tsc -p tsconfig.json",
12
+ "build": "tsc -p tsconfig.json",
13
13
  "typecheck": "tsc --noEmit -p tsconfig.json",
14
14
  "prepack": "rm -rf dist && npm run build",
15
15
  "generate": "node scripts/generate-wire.mjs",