@ziggs-ai/api-client 0.10.0 → 0.10.1
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.
|
@@ -17,6 +17,10 @@ function reportingHint(env, contentType, taskId) {
|
|
|
17
17
|
}
|
|
18
18
|
return `Reporting finished work? Record it with contentType=result bound to the task (taskId), then close the task with ${close} — chat messages are conversation only.`;
|
|
19
19
|
}
|
|
20
|
+
/** ZIG-1320 — inline body cap + escape hatch, shared by SDK/MCP descriptions. */
|
|
21
|
+
const ARTIFACT_RECORD_INLINE_CAP = 'Inline text max 50000 characters. Over that: use ziggs_artifact_upload_url ' +
|
|
22
|
+
'(file rail), or record an index artifact plus part artifacts and list the ' +
|
|
23
|
+
'part ids in the index. The server does not auto-split.';
|
|
20
24
|
export const recordArtifactCapability = {
|
|
21
25
|
key: 'artifact_record',
|
|
22
26
|
names: { sdk: 'artifact_record', mcp: 'ziggs_artifact_record' },
|
|
@@ -25,17 +29,23 @@ export const recordArtifactCapability = {
|
|
|
25
29
|
sdk: 'Write an artifact. Scope is optional: pass agreementId or chatId to record it there, ' +
|
|
26
30
|
'or pass no scope at all to record it as yours alone and attach it somewhere later. ' +
|
|
27
31
|
'Set visibility explicitly. For a finished deliverable, set contentType=result and pass ' +
|
|
28
|
-
'taskId to bind it to the task — heavy results belong in artifacts, not chat messages.'
|
|
32
|
+
'taskId to bind it to the task — heavy results belong in artifacts, not chat messages. ' +
|
|
33
|
+
ARTIFACT_RECORD_INLINE_CAP,
|
|
29
34
|
mcp: 'Write an artifact. Scope is optional — pass agreementId or chatId to record it into that ' +
|
|
30
35
|
'scope, pass taskId alone to bind a deliverable to its task, or pass no scope at all for a ' +
|
|
31
36
|
'free-standing artifact that is yours until you attach or share it. Never guess a scope: ' +
|
|
32
37
|
'recording with none always succeeds. Set visibility explicitly. ' +
|
|
33
38
|
'For a finished deliverable, set contentType=result and pass taskId to bind it to the task. ' +
|
|
34
|
-
'Finished work is the task result — set it with ziggs_task_set_result; never report finished work as a chat message (chat is conversation only).'
|
|
39
|
+
'Finished work is the task result — set it with ziggs_task_set_result; never report finished work as a chat message (chat is conversation only). ' +
|
|
40
|
+
ARTIFACT_RECORD_INLINE_CAP,
|
|
35
41
|
},
|
|
36
42
|
annotation: 'write',
|
|
37
43
|
params: {
|
|
38
|
-
text: {
|
|
44
|
+
text: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
required: true,
|
|
47
|
+
description: 'Artifact body (max 50000 chars). Over limit: ziggs_artifact_upload_url or index+parts.',
|
|
48
|
+
},
|
|
39
49
|
visibility: {
|
|
40
50
|
type: 'string',
|
|
41
51
|
required: true,
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline `POST /artifacts` body cap (matches backend
|
|
3
|
+
* `ARTIFACT_PUBLIC_TEXT_MAX_CHARS`). Over this → file rail or multi-part; the
|
|
4
|
+
* server does not auto-split (ZIG-1320).
|
|
5
|
+
*/
|
|
6
|
+
export declare const ARTIFACT_INLINE_TEXT_MAX_CHARS = 50000;
|
|
7
|
+
/** ZIG-1320 — named escape hatch for agents that hit the inline cap. */
|
|
8
|
+
export declare const ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT: string;
|
|
1
9
|
export type ArtifactVisibility = 'chat' | 'agent-private';
|
|
2
10
|
export interface ListArtifactsOptions {
|
|
3
11
|
after?: string;
|
|
@@ -2,6 +2,17 @@ import { runtimeLog } from '../shared/runtimeLog.js';
|
|
|
2
2
|
import { throwApiError } from '../shared/apiError.js';
|
|
3
3
|
import { getBackendUrl } from '../utils/urlUtils.js';
|
|
4
4
|
import { buildOperatorHeaders } from './operatorHeaders.js';
|
|
5
|
+
/**
|
|
6
|
+
* Inline `POST /artifacts` body cap (matches backend
|
|
7
|
+
* `ARTIFACT_PUBLIC_TEXT_MAX_CHARS`). Over this → file rail or multi-part; the
|
|
8
|
+
* server does not auto-split (ZIG-1320).
|
|
9
|
+
*/
|
|
10
|
+
export const ARTIFACT_INLINE_TEXT_MAX_CHARS = 50_000;
|
|
11
|
+
/** ZIG-1320 — named escape hatch for agents that hit the inline cap. */
|
|
12
|
+
export const ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT = `text exceeds ${ARTIFACT_INLINE_TEXT_MAX_CHARS} characters. ` +
|
|
13
|
+
'For larger content use ziggs_artifact_upload_url (file rail), or split into ' +
|
|
14
|
+
'an index artifact plus part artifacts and list the part ids in the index. ' +
|
|
15
|
+
'The server does not auto-split.';
|
|
5
16
|
function resolveUploadBytes(input) {
|
|
6
17
|
if (input.content != null) {
|
|
7
18
|
return Buffer.isBuffer(input.content)
|
|
@@ -122,12 +133,18 @@ export class ArtifactsClient {
|
|
|
122
133
|
throw new Error('ArtifactsClient.writeStrict: text is required');
|
|
123
134
|
}
|
|
124
135
|
this._assertScopeXor(input);
|
|
136
|
+
const text = input.text.trim();
|
|
137
|
+
// ZIG-1320: refuse before the wire so MCP/SDK get a named escape hatch
|
|
138
|
+
// instead of a bare class-validator string.
|
|
139
|
+
if (text.length > ARTIFACT_INLINE_TEXT_MAX_CHARS) {
|
|
140
|
+
throw new Error(`ArtifactsClient.writeStrict: ${ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT}`);
|
|
141
|
+
}
|
|
125
142
|
const url = `${getBackendUrl()}/artifacts`;
|
|
126
143
|
const res = await fetch(url, {
|
|
127
144
|
method: 'POST',
|
|
128
145
|
headers: this._headers(),
|
|
129
146
|
body: JSON.stringify({
|
|
130
|
-
text
|
|
147
|
+
text,
|
|
131
148
|
contentType: input.contentType ?? 'text',
|
|
132
149
|
visibility: input.visibility ?? 'chat',
|
|
133
150
|
chatId: input.chatId,
|
package/dist/http/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export * from './agreementFlows.js';
|
|
|
5
5
|
export * from './ChatClient.js';
|
|
6
6
|
export { MessagesClient } from './MessagesClient.js';
|
|
7
7
|
export type { ListMessagesOptions, ListMessagesResult } from './MessagesClient.js';
|
|
8
|
-
export { ArtifactsClient, artifactScopeForSession, AGREEMENT_LANE_PREFIX, } from './ArtifactsClient.js';
|
|
8
|
+
export { ArtifactsClient, artifactScopeForSession, AGREEMENT_LANE_PREFIX, ARTIFACT_INLINE_TEXT_MAX_CHARS, ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT, } from './ArtifactsClient.js';
|
|
9
9
|
export type { ArtifactVisibility, ListArtifactsOptions, ListArtifactsQuery, ListArtifactsResult, WriteArtifactInput, } from './ArtifactsClient.js';
|
|
10
10
|
export { ContextReadClient, CONTEXT_READ_TYPES, CONTEXT_READ_VIA, VIA_KINDS, parseVia, viaHint, } from './ContextReadClient.js';
|
|
11
11
|
export type { ContextReadType, ContextReadQuery, ContextReadEnvelope, ContextSnapshotResult, ViaKind, } from './ContextReadClient.js';
|
package/dist/http/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export * from './ChatClient.js';
|
|
|
6
6
|
export { MessagesClient } from './MessagesClient.js';
|
|
7
7
|
export { ArtifactsClient,
|
|
8
8
|
// agreement lanes are not chats — callers scope artifact writes with this.
|
|
9
|
-
artifactScopeForSession, AGREEMENT_LANE_PREFIX, } from './ArtifactsClient.js';
|
|
9
|
+
artifactScopeForSession, AGREEMENT_LANE_PREFIX, ARTIFACT_INLINE_TEXT_MAX_CHARS, ARTIFACT_INLINE_TEXT_OVER_LIMIT_HINT, } from './ArtifactsClient.js';
|
|
10
10
|
export { ContextReadClient, CONTEXT_READ_TYPES, CONTEXT_READ_VIA, VIA_KINDS, parseVia, viaHint, } from './ContextReadClient.js';
|
|
11
11
|
export { ContextDiscoveryClient } from './ContextDiscoveryClient.js';
|
|
12
12
|
export { GrantsClient } from './GrantsClient.js';
|