@agent-phonon/protocol 0.9.1 → 0.10.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 +35 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/native-version.d.ts +6 -0
- package/dist/native-version.d.ts.map +1 -0
- package/dist/native-version.js +41 -0
- package/dist/native-version.js.map +1 -0
- package/dist/schemas/capabilities.d.ts +9 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +3 -0
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/common.d.ts +4 -4
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +9 -0
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/compression.d.ts +191 -0
- package/dist/schemas/compression.d.ts.map +1 -0
- package/dist/schemas/compression.js +18 -0
- package/dist/schemas/compression.js.map +1 -0
- package/dist/schemas/conversation-archive.d.ts +1021 -0
- package/dist/schemas/conversation-archive.d.ts.map +1 -0
- package/dist/schemas/conversation-archive.js +148 -0
- package/dist/schemas/conversation-archive.js.map +1 -0
- package/dist/schemas/conversation-board.d.ts +428 -0
- package/dist/schemas/conversation-board.d.ts.map +1 -0
- package/dist/schemas/conversation-board.js +32 -0
- package/dist/schemas/conversation-board.js.map +1 -0
- package/dist/schemas/conversation-message.d.ts +658 -0
- package/dist/schemas/conversation-message.d.ts.map +1 -0
- package/dist/schemas/conversation-message.js +42 -0
- package/dist/schemas/conversation-message.js.map +1 -0
- package/dist/schemas/conversation-workflow.d.ts +1201 -0
- package/dist/schemas/conversation-workflow.d.ts.map +1 -0
- package/dist/schemas/conversation-workflow.js +68 -0
- package/dist/schemas/conversation-workflow.js.map +1 -0
- package/dist/schemas/device.d.ts +198 -2
- package/dist/schemas/device.d.ts.map +1 -1
- package/dist/schemas/device.js +29 -1
- package/dist/schemas/device.js.map +1 -1
- package/dist/schemas/discovery.d.ts +107 -0
- package/dist/schemas/discovery.d.ts.map +1 -1
- package/dist/schemas/discovery.js +2 -0
- package/dist/schemas/discovery.js.map +1 -1
- package/dist/schemas/document.d.ts +56 -26
- package/dist/schemas/document.d.ts.map +1 -1
- package/dist/schemas/document.js +11 -0
- package/dist/schemas/document.js.map +1 -1
- package/dist/schemas/employee.d.ts +139 -0
- package/dist/schemas/employee.d.ts.map +1 -0
- package/dist/schemas/employee.js +17 -0
- package/dist/schemas/employee.js.map +1 -0
- package/dist/schemas/env.d.ts +15 -15
- package/dist/schemas/env.d.ts.map +1 -1
- package/dist/schemas/env.js +1 -1
- package/dist/schemas/env.js.map +1 -1
- package/dist/schemas/file.d.ts +6 -6
- package/dist/schemas/hook.d.ts +4 -4
- package/dist/schemas/interaction.d.ts +363 -2
- package/dist/schemas/interaction.d.ts.map +1 -1
- package/dist/schemas/interaction.js +28 -1
- package/dist/schemas/interaction.js.map +1 -1
- package/dist/schemas/jsonrpc.d.ts +19 -19
- package/dist/schemas/maintenance.d.ts +822 -0
- package/dist/schemas/maintenance.d.ts.map +1 -0
- package/dist/schemas/maintenance.js +166 -0
- package/dist/schemas/maintenance.js.map +1 -0
- package/dist/schemas/managed-mcp.d.ts +116 -0
- package/dist/schemas/managed-mcp.d.ts.map +1 -0
- package/dist/schemas/managed-mcp.js +23 -0
- package/dist/schemas/managed-mcp.js.map +1 -0
- package/dist/schemas/methods.d.ts +22186 -2362
- package/dist/schemas/methods.d.ts.map +1 -1
- package/dist/schemas/methods.js +181 -6
- package/dist/schemas/methods.js.map +1 -1
- package/dist/schemas/native-stop.d.ts +162 -0
- package/dist/schemas/native-stop.d.ts.map +1 -0
- package/dist/schemas/native-stop.js +14 -0
- package/dist/schemas/native-stop.js.map +1 -0
- package/dist/schemas/policy.d.ts +42 -2
- package/dist/schemas/policy.d.ts.map +1 -1
- package/dist/schemas/policy.js +20 -0
- package/dist/schemas/policy.js.map +1 -1
- package/dist/schemas/project-coordination.d.ts +1956 -0
- package/dist/schemas/project-coordination.d.ts.map +1 -0
- package/dist/schemas/project-coordination.js +81 -0
- package/dist/schemas/project-coordination.js.map +1 -0
- package/dist/schemas/project.d.ts +771 -53
- package/dist/schemas/project.d.ts.map +1 -1
- package/dist/schemas/project.js +60 -5
- package/dist/schemas/project.js.map +1 -1
- package/dist/schemas/reasoning.d.ts +26 -0
- package/dist/schemas/reasoning.d.ts.map +1 -0
- package/dist/schemas/reasoning.js +10 -0
- package/dist/schemas/reasoning.js.map +1 -0
- package/dist/schemas/schedule.d.ts +15148 -5022
- package/dist/schemas/schedule.d.ts.map +1 -1
- package/dist/schemas/schedule.js +46 -5
- package/dist/schemas/schedule.js.map +1 -1
- package/dist/schemas/session.d.ts +1558 -49
- package/dist/schemas/session.d.ts.map +1 -1
- package/dist/schemas/session.js +27 -16
- package/dist/schemas/session.js.map +1 -1
- package/dist/schemas/skill.d.ts +1009 -8
- package/dist/schemas/skill.d.ts.map +1 -1
- package/dist/schemas/skill.js +39 -0
- package/dist/schemas/skill.js.map +1 -1
- package/dist/schemas/stream.d.ts +1060 -67
- package/dist/schemas/stream.d.ts.map +1 -1
- package/dist/schemas/stream.js +18 -3
- package/dist/schemas/stream.js.map +1 -1
- package/dist/schemas/workflow.d.ts +2764 -255
- package/dist/schemas/workflow.d.ts.map +1 -1
- package/dist/schemas/workflow.js +69 -1
- package/dist/schemas/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +12 -0
- package/src/native-version.ts +30 -0
- package/src/schemas/capabilities.ts +3 -0
- package/src/schemas/common.ts +9 -0
- package/src/schemas/compression.ts +19 -0
- package/src/schemas/conversation-archive.ts +155 -0
- package/src/schemas/conversation-board.ts +36 -0
- package/src/schemas/conversation-message.ts +46 -0
- package/src/schemas/conversation-workflow.ts +62 -0
- package/src/schemas/device.ts +32 -1
- package/src/schemas/discovery.ts +2 -0
- package/src/schemas/document.ts +13 -0
- package/src/schemas/employee.ts +19 -0
- package/src/schemas/env.ts +1 -1
- package/src/schemas/interaction.ts +32 -1
- package/src/schemas/maintenance.ts +204 -0
- package/src/schemas/managed-mcp.ts +25 -0
- package/src/schemas/methods.ts +208 -1
- package/src/schemas/native-stop.ts +16 -0
- package/src/schemas/policy.ts +20 -0
- package/src/schemas/project-coordination.ts +90 -0
- package/src/schemas/project.ts +72 -5
- package/src/schemas/reasoning.ts +13 -0
- package/src/schemas/schedule.ts +54 -5
- package/src/schemas/session.ts +30 -18
- package/src/schemas/skill.ts +52 -0
- package/src/schemas/stream.ts +22 -3
- package/src/schemas/workflow.ts +82 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SessionId } from "./common.js";
|
|
3
|
+
|
|
4
|
+
const id = z.string().uuid().transform(value => value.toLowerCase());
|
|
5
|
+
const members = z.object({ operation: z.literal("members") }).strict();
|
|
6
|
+
const order=z.string().regex(/^(0|[1-9][0-9]{0,18})$/).refine(value=>/^(0|[1-9][0-9]{0,18})$/.test(value)&&BigInt(value)<=9223372036854775807n);
|
|
7
|
+
const history=z.object({operation:z.literal("history"),beforeOrder:order.optional(),throughOrder:order.optional(),limit:z.number().int().min(1).max(40).optional()}).strict();
|
|
8
|
+
const read=z.object({operation:z.literal("read"),messageID:id,offset:z.number().int().min(0).max(2147483646).optional()}).strict();
|
|
9
|
+
const send = z.object({ operation: z.literal("send"), requestId: id,
|
|
10
|
+
text: z.string().max(4000),
|
|
11
|
+
mentionIDs: z.array(id).min(1).max(8), mode: z.enum(["insert", "wait", "queue"]),
|
|
12
|
+
attachmentIDs:z.array(z.string().regex(/^native-file:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)).max(5).optional()
|
|
13
|
+
.describe("Explicit immutable files already published in this conversation/project. At most five files and 25 MiB. Use serverRef, never device paths or URLs. Recorded does not prove recipient file delivery."),
|
|
14
|
+
}).strict();
|
|
15
|
+
const status = z.object({ operation: z.literal("status"), requestId: id }).strict();
|
|
16
|
+
const distinct = (value: { operation: string; text?:string;mentionIDs?: string[];attachmentIDs?:string[] }) =>
|
|
17
|
+
value.operation !== "send" || new Set(value.mentionIDs).size === value.mentionIDs?.length
|
|
18
|
+
&&new Set(value.attachmentIDs).size===(value.attachmentIDs?.length??0)
|
|
19
|
+
&&(!!value.text?.trim()||!!value.attachmentIDs?.length);
|
|
20
|
+
/** Agent-authored content only; current conversation and sender are controller-owned. */
|
|
21
|
+
export const AgentMessageInput = z.discriminatedUnion("operation", [members, history, read, send, status]).refine(distinct);
|
|
22
|
+
export type AgentMessageInput = z.infer<typeof AgentMessageInput>;
|
|
23
|
+
const lineage = { nativeRunId: id, workflowId: z.string().min(1).max(512), sessionId: SessionId, turnId: z.string().min(1).max(512) };
|
|
24
|
+
export const ConversationMessageParams = z.discriminatedUnion("operation", [
|
|
25
|
+
members.extend(lineage).strict(), history.extend(lineage).strict(),read.extend(lineage).strict(),send.extend(lineage).strict(), status.extend(lineage).strict(),
|
|
26
|
+
]).refine(distinct);
|
|
27
|
+
export type ConversationMessageParams = z.infer<typeof ConversationMessageParams>;
|
|
28
|
+
const receipt = z.object({ personID: id, state: z.enum(["recorded", "sending", "pendingInsert", "waiting", "queued", "accepted", "running", "succeeded", "removed", "unsupported", "notAccepted", "offline", "failed", "unknown", "cancelled"]), errorCode: z.string().max(128).optional() }).strict();
|
|
29
|
+
const historyMessage=z.object({id,historyOrder:order,author:z.enum(["human","assistant","system"]),senderID:z.string().max(512),senderName:z.string().max(240),
|
|
30
|
+
createdAt:z.string().datetime({offset:true}),text:z.string().max(12000),textLength:z.number().int().nonnegative(),isExcerpt:z.boolean(),mentionIDs:z.array(id).max(32),
|
|
31
|
+
originKind:z.string().max(128).optional(),attachmentIDs:z.array(z.string().regex(/^native-(file|result):[0-9a-f-]{36}$/)).max(5),
|
|
32
|
+
runID:id.optional(),workflowID:id.optional(),requestID:id.optional()}).strict();
|
|
33
|
+
export const ConversationMessageResult = z.discriminatedUnion("status", [
|
|
34
|
+
z.object({status:z.literal("history"),conversationID:id,projectID:id,throughOrder:order,messages:z.array(historyMessage).max(40),nextBeforeOrder:order.optional()}).strict(),
|
|
35
|
+
z.object({status:z.literal("message"),conversationID:id,projectID:id,message:historyMessage,offset:z.number().int().nonnegative(),nextOffset:z.number().int().positive().optional()}).strict(),
|
|
36
|
+
z.object({ status: z.literal("members"), conversationID: id, projectID: id, senderID: id, enabled: z.boolean(),
|
|
37
|
+
members: z.array(z.object({ id, name: z.string().max(120) }).strict()).max(32),
|
|
38
|
+
limits: z.object({ maxHops: z.number().int().positive(), maxDeliveries: z.number().int().positive(), maxRecipients: z.number().int().positive(), maxRoots: z.number().int().positive() }).strict(),
|
|
39
|
+
}).strict(),
|
|
40
|
+
z.object({ status: z.literal("recorded"), requestId: id, messageID: id, chainID: id, rootMessageID: id,
|
|
41
|
+
depth: z.number().int().positive().max(12), receipts: z.array(receipt).max(8), replayed: z.boolean().optional(),
|
|
42
|
+
}).strict(),
|
|
43
|
+
z.object({ status: z.literal("not_found"), requestId: id }).strict(),
|
|
44
|
+
z.object({ status: z.literal("not_accepted"), requestId: id, errorCode: z.string().min(1).max(128) }).strict(),
|
|
45
|
+
]);
|
|
46
|
+
export type ConversationMessageResult = z.infer<typeof ConversationMessageResult>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TurnReasoning } from "./reasoning.js";
|
|
3
|
+
import { SessionId } from "./common.js";
|
|
4
|
+
import { SkillSelection } from "./skill.js";
|
|
5
|
+
|
|
6
|
+
export const ConversationWorkflowSkill=SkillSelection.options[1].pick({name:true,version:true,revision:true,installationId:true})
|
|
7
|
+
.required({revision:true,installationId:true});
|
|
8
|
+
export const ConversationWorkflowSkills=z.array(ConversationWorkflowSkill).min(1).max(16)
|
|
9
|
+
.refine(values=>new Set(values.map(value=>value.name)).size===values.length,"Duplicate skill name");
|
|
10
|
+
const skillTarget=z.object({agentID:z.string().uuid(),bindingID:z.string().uuid()}).strict();
|
|
11
|
+
const canvasSkill=z.object({productID:z.string().regex(/^[A-Za-z0-9_-]{1,128}$/),deviceBindingID:z.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
|
|
12
|
+
baseBindingRevision:z.string().uuid(),operationID:z.string().uuid()}).strict();
|
|
13
|
+
|
|
14
|
+
export const ConversationWorkflowNode=z.object({
|
|
15
|
+
id:z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/),title:z.string().min(1).max(240),
|
|
16
|
+
agentID:z.string().uuid(),roleID:z.string().uuid().optional(),bindingID:z.string().uuid(),
|
|
17
|
+
input:z.string().min(1).max(12000),dependsOn:z.array(z.string().max(64)).max(16).default([]),
|
|
18
|
+
attachmentIDs:z.array(z.string().regex(/^native-file:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/)).max(5).optional().describe("Explicit existing input file IDs from this conversation and execution project, never device paths. Files are verified on the actual worker device before dispatch."),
|
|
19
|
+
artifactSources:z.array(z.string().max(64)).max(16).optional().describe("Direct dependency node IDs whose published files must be transferred to this worker. No implicit forwarding. Combined inputs are capped at five files and 25 MiB."),
|
|
20
|
+
reasoning:TurnReasoning.optional(),
|
|
21
|
+
skills:ConversationWorkflowSkills.optional().describe("Exact immutable Project skill selections from catalog skillTarget. No global scope, device path or permission override. Pins are part of the frozen plan and human review."),
|
|
22
|
+
canvasSkill:canvasSkill.optional().describe("Current Canvas product/association and recorded installation references. Uses the post-install binding revision. The controller checks fresh business authority and receipt/source identity; no credentials, source paths or approvals are accepted."),
|
|
23
|
+
}).strict();
|
|
24
|
+
export const ConversationWorkflowPlan=z.object({
|
|
25
|
+
projectID:z.string().uuid(),title:z.string().min(1).max(240),goal:z.string().min(1).max(4000),
|
|
26
|
+
review:z.enum(["request","not_requested"]),maxParallel:z.number().int().min(1).max(4).default(2),
|
|
27
|
+
nodes:z.array(ConversationWorkflowNode).min(1).max(16),
|
|
28
|
+
}).strict().superRefine((plan,ctx)=>{
|
|
29
|
+
const nodes=new Map(plan.nodes.map(node=>[node.id,node]));
|
|
30
|
+
if(nodes.size!==plan.nodes.length){ctx.addIssue({code:"custom",message:"Duplicate node"});return;}
|
|
31
|
+
const visited=new Set<string>(),active=new Set<string>();
|
|
32
|
+
const visit=(id:string):boolean=>{
|
|
33
|
+
if(active.has(id)||!nodes.has(id))return false;
|
|
34
|
+
if(visited.has(id))return true;
|
|
35
|
+
active.add(id);
|
|
36
|
+
const node=nodes.get(id)!;
|
|
37
|
+
if(node.canvasSkill&&(node.skills?.length===16||node.skills?.some(skill=>skill.name==="product-intent-canvas")))return false;
|
|
38
|
+
if(new Set(node.attachmentIDs).size!==(node.attachmentIDs?.length??0)||new Set(node.artifactSources).size!==(node.artifactSources?.length??0)||node.artifactSources?.some(source=>!node.dependsOn.includes(source)))return false;
|
|
39
|
+
if(new Set(node.dependsOn).size!==node.dependsOn.length||node.dependsOn.some(dependency=>!visit(dependency)))return false;
|
|
40
|
+
active.delete(id);visited.add(id);return true;
|
|
41
|
+
};
|
|
42
|
+
if(plan.nodes.some(node=>!visit(node.id)))ctx.addIssue({code:"custom",message:"Dependencies must form a DAG"});
|
|
43
|
+
});
|
|
44
|
+
export type ConversationWorkflowPlan=z.infer<typeof ConversationWorkflowPlan>;
|
|
45
|
+
export const AgentWorkflowInput=z.discriminatedUnion("operation",[
|
|
46
|
+
z.object({operation:z.literal("catalog"),projectID:z.string().uuid().optional(),offset:z.number().int().nonnegative().safe().optional(),skillTarget:skillTarget.optional()}).strict(),
|
|
47
|
+
z.object({operation:z.literal("execute"),requestId:z.string().uuid(),replacesRequestId:z.string().uuid().optional(),delivery:z.enum(["wait","detached"]).optional(),plan:ConversationWorkflowPlan}).strict(),
|
|
48
|
+
z.object({operation:z.literal("status"),requestId:z.string().uuid(),nodeID:z.string().max(64).optional(),offset:z.number().int().nonnegative().safe().optional()}).strict(),
|
|
49
|
+
]);
|
|
50
|
+
export type AgentWorkflowInput=z.infer<typeof AgentWorkflowInput>;
|
|
51
|
+
const source={nativeRunId:z.string().uuid(),workflowId:z.string().min(1).max(255),sessionId:SessionId,turnId:z.string().min(1).max(255)};
|
|
52
|
+
export const ConversationWorkflowParams=z.discriminatedUnion("operation",[
|
|
53
|
+
AgentWorkflowInput.options[0].extend(source),AgentWorkflowInput.options[1].extend(source),AgentWorkflowInput.options[2].extend(source),
|
|
54
|
+
]);
|
|
55
|
+
export type ConversationWorkflowParams=AgentWorkflowInput & {nativeRunId:string;workflowId:string;sessionId:string;turnId:string};
|
|
56
|
+
export const ConversationWorkflowResult=z.object({
|
|
57
|
+
status:z.enum(["catalog","status","finished","unknown"]),
|
|
58
|
+
// Resource catalogs and execution results are control-plane-owned JSON, not
|
|
59
|
+
// a caller-selected RPC method or device path.
|
|
60
|
+
data:z.record(z.unknown()),
|
|
61
|
+
}).strict();
|
|
62
|
+
export type ConversationWorkflowResult=z.infer<typeof ConversationWorkflowResult>;
|
package/src/schemas/device.ts
CHANGED
|
@@ -13,6 +13,20 @@ export type DeviceFsRoot = z.infer<typeof DeviceFsRoot>;
|
|
|
13
13
|
export const DeviceInfoParams = z.object({}).default({});
|
|
14
14
|
export type DeviceInfoParams = z.infer<typeof DeviceInfoParams>;
|
|
15
15
|
|
|
16
|
+
export const DeviceSSHAddress = z.object({
|
|
17
|
+
address: z.string().ip(),
|
|
18
|
+
kind: z.enum(["public", "private", "tailscale"]),
|
|
19
|
+
family: z.enum(["IPv4", "IPv6"]),
|
|
20
|
+
interface: z.string().max(120).optional(),
|
|
21
|
+
});
|
|
22
|
+
export type DeviceSSHAddress = z.infer<typeof DeviceSSHAddress>;
|
|
23
|
+
export const DeviceSSHHints = z.object({
|
|
24
|
+
username: z.string().min(1).max(255).optional(),
|
|
25
|
+
port: z.number().int().min(1).max(65535),
|
|
26
|
+
addresses: z.array(DeviceSSHAddress).max(64),
|
|
27
|
+
});
|
|
28
|
+
export type DeviceSSHHints = z.infer<typeof DeviceSSHHints>;
|
|
29
|
+
|
|
16
30
|
export const DeviceInfoResult = z.object({
|
|
17
31
|
at: z.string().datetime({ offset: true }),
|
|
18
32
|
hostname: z.string(),
|
|
@@ -25,7 +39,17 @@ export const DeviceInfoResult = z.object({
|
|
|
25
39
|
runtime: z.object({
|
|
26
40
|
node: z.string().optional(),
|
|
27
41
|
}).optional(),
|
|
42
|
+
/** Connection hints only, not proof that sshd or an address is reachable. No credentials. */
|
|
43
|
+
ssh: DeviceSSHHints.optional(),
|
|
44
|
+
/** Persistent namespace-scoped receiver identity, not a credential or grant. */
|
|
45
|
+
skillReceiverID:z.string().uuid().optional(),
|
|
46
|
+
projectProvisionReceiverID:z.string().uuid().optional(),
|
|
47
|
+
worktreeProvisionReceiverID:z.string().uuid().optional(),
|
|
28
48
|
/** 便于 server 做粗粒度任务路由:ios-development/windows-desktop-development/nvidia-gpu 等。 */
|
|
49
|
+
/** current_turn_input_v1 confirms strict no-fallback and applied-input ACK semantics;
|
|
50
|
+
* the selected adapter must additionally advertise injectMidTurn.
|
|
51
|
+
* native_interaction_receipts_v1 provides durable response-consumption proofs,
|
|
52
|
+
* not proof that a task/side effect completed or that every harness has a tool. */
|
|
29
53
|
capabilities: z.array(z.string()).default([]),
|
|
30
54
|
});
|
|
31
55
|
export type DeviceInfoResult = z.infer<typeof DeviceInfoResult>;
|
|
@@ -91,7 +115,9 @@ export const DeviceFsListParams = z.object({
|
|
|
91
115
|
absolutePath: z.string().optional(),
|
|
92
116
|
includeHidden: z.boolean().default(false).optional(),
|
|
93
117
|
limit: z.number().int().positive().max(1000).default(200).optional(),
|
|
94
|
-
|
|
118
|
+
projectCandidates:z.boolean().optional(),
|
|
119
|
+
directoryInput:z.string().max(4096).refine(value=>!/[\x00-\x1f\x7f]/.test(value)).optional(),
|
|
120
|
+
}).refine(value=>value.projectCandidates===true?value.root===undefined&&value.path===undefined&&value.absolutePath===undefined:value.directoryInput===undefined,"Directory candidates use only device-native directoryInput");
|
|
95
121
|
export type DeviceFsListParams = z.infer<typeof DeviceFsListParams>;
|
|
96
122
|
|
|
97
123
|
export const DeviceFsEntry = z.object({
|
|
@@ -101,6 +127,8 @@ export const DeviceFsEntry = z.object({
|
|
|
101
127
|
kind: z.enum(["file", "directory", "symlink", "other"]),
|
|
102
128
|
size: z.number().int().nonnegative().optional(),
|
|
103
129
|
mtimeMs: z.number().nonnegative().optional(),
|
|
130
|
+
directoryIdentity:z.string().regex(/^dir:[a-f0-9]+:[a-f0-9]+$/).max(96).optional(),
|
|
131
|
+
selectable:z.boolean().optional(),
|
|
104
132
|
});
|
|
105
133
|
export type DeviceFsEntry = z.infer<typeof DeviceFsEntry>;
|
|
106
134
|
|
|
@@ -111,5 +139,8 @@ export const DeviceFsListResult = z.object({
|
|
|
111
139
|
realPath: z.string(),
|
|
112
140
|
entries: z.array(DeviceFsEntry),
|
|
113
141
|
truncated: z.boolean().default(false),
|
|
142
|
+
input:z.string().max(4096).optional(),
|
|
143
|
+
pathStyle:z.enum(["posix","windows"]).optional(),
|
|
144
|
+
directoryMatch:z.object({path:z.string().min(1).max(4096),directoryIdentity:z.string().regex(/^dir:[a-f0-9]+:[a-f0-9]+$/).max(96),selectable:z.boolean()}).optional(),
|
|
114
145
|
});
|
|
115
146
|
export type DeviceFsListResult = z.infer<typeof DeviceFsListResult>;
|
package/src/schemas/discovery.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AgentId, Timestamp } from "./common.js";
|
|
3
3
|
import { AgentCapabilities } from "./capabilities.js";
|
|
4
|
+
import { ReasoningLevel } from "./reasoning.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Agent / 模型发现(design §5 / D14)。
|
|
@@ -20,6 +21,7 @@ export const ModelInfo = z.object({
|
|
|
20
21
|
contextWindow: z.number().int().positive().optional(),
|
|
21
22
|
/** 该模型当前是否可用(如鉴权过期会变 false)。 */
|
|
22
23
|
available: z.boolean().default(true),
|
|
24
|
+
reasoningLevels: z.array(ReasoningLevel).max(5).optional(),
|
|
23
25
|
});
|
|
24
26
|
export type ModelInfo = z.infer<typeof ModelInfo>;
|
|
25
27
|
|
package/src/schemas/document.ts
CHANGED
|
@@ -47,6 +47,16 @@ export const DocumentDirective = z.object({
|
|
|
47
47
|
});
|
|
48
48
|
export type DocumentDirective = z.infer<typeof DocumentDirective>;
|
|
49
49
|
|
|
50
|
+
export const NativeDocumentInput = z.object({
|
|
51
|
+
requestId: z.string().uuid().transform(value => value.toLowerCase()),
|
|
52
|
+
path: z.string().min(1).max(4096).refine(value => !value.startsWith("/") && !value.includes("\\") && !value.includes("\0") && !value.split("/").includes("..")),
|
|
53
|
+
name: z.string().min(1).max(240).refine(value => value !== "." && value !== ".." && !/[\\/\x00-\x1f\x7f]/.test(value)).optional(),
|
|
54
|
+
mimeType: z.string().max(120).regex(/^[a-zA-Z0-9!#$&^_.+-]+\/[a-zA-Z0-9!#$&^_.+-]+$/).optional(),
|
|
55
|
+
caption: z.string().max(2000).optional(),
|
|
56
|
+
}).strict();
|
|
57
|
+
export type NativeDocumentInput = z.infer<typeof NativeDocumentInput>;
|
|
58
|
+
export const NATIVE_DOCUMENT_MAX_BYTES = 10 * 1024 * 1024;
|
|
59
|
+
|
|
50
60
|
/** 单个文档的线上描述(phonon 读完本地文件后封装)。 */
|
|
51
61
|
export const DocumentDescriptor = z.object({
|
|
52
62
|
name: z.string().min(1),
|
|
@@ -64,6 +74,9 @@ export type DocumentDescriptor = z.infer<typeof DocumentDescriptor>;
|
|
|
64
74
|
|
|
65
75
|
// --- document.send(phonon → server)---
|
|
66
76
|
export const DocumentSendParams = z.object({
|
|
77
|
+
nativeRunId: z.string().uuid().optional(),
|
|
78
|
+
workflowId: z.string().min(1).max(512).optional(),
|
|
79
|
+
requestId: z.string().uuid().optional(),
|
|
67
80
|
/** 关联会话(通常有;纯设备级发送可省)。 */
|
|
68
81
|
sessionId: SessionId.optional(),
|
|
69
82
|
/** 关联轮次(若在某轮对话内触发)。 */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AgentId } from "./common.js";
|
|
3
|
+
|
|
4
|
+
export const EmployeeSelection=z.object({id:z.string().uuid(),revision:z.number().int().positive()}).strict();
|
|
5
|
+
export const EmployeeProfileApplyParams=z.object({
|
|
6
|
+
employeeId:z.string().uuid(),revision:z.number().int().positive(),agent:AgentId,model:z.string().min(1).max(240),
|
|
7
|
+
profileId:z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/),
|
|
8
|
+
name:z.string().min(1).max(120),responsibility:z.string().max(4000),
|
|
9
|
+
documents:z.object({soul:z.string().max(100000),agents:z.string().max(100000),user:z.string().max(100000),tools:z.string().max(100000)}).strict(),
|
|
10
|
+
}).strict();
|
|
11
|
+
export type EmployeeProfileApplyParams=z.infer<typeof EmployeeProfileApplyParams>;
|
|
12
|
+
export const EmployeeProfileStatusParams=z.object({employeeId:z.string().uuid()});
|
|
13
|
+
export const EmployeeProfileStatusResult=z.object({
|
|
14
|
+
employeeId:z.string().uuid(),revision:z.number().int().positive(),requestHash:z.string().regex(/^[a-f0-9]{64}$/),
|
|
15
|
+
state:z.enum(["provisioning","ready","failed"]),agent:AgentId,profileId:z.string(),provider:z.string(),
|
|
16
|
+
runtimeProfile:z.string(),privateWorkspace:z.object({projectId:z.string().min(1),path:z.string(),name:z.string(),employeeId:z.string().uuid()}).optional(),
|
|
17
|
+
documentHashes:z.record(z.string()).optional(),memoryBytes:z.number().int().nonnegative().optional(),errorCode:z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
export type EmployeeProfileStatusResult=z.infer<typeof EmployeeProfileStatusResult>;
|
package/src/schemas/env.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ProjectId, AgentId } from "./common.js";
|
|
3
3
|
|
|
4
|
-
/** Skill / agent
|
|
4
|
+
/** Skill / agent 执行环境变量配置。值在设备本地以 AES-256-GCM 加密存储,list 默认脱敏。 */
|
|
5
5
|
export const EnvScope = z.enum(["global", "project", "skill"]);
|
|
6
6
|
export type EnvScope = z.infer<typeof EnvScope>;
|
|
7
7
|
|
|
@@ -63,6 +63,12 @@ export const InteractionForm = z.object({
|
|
|
63
63
|
});
|
|
64
64
|
export type InteractionForm = z.infer<typeof InteractionForm>;
|
|
65
65
|
|
|
66
|
+
export const InteractionPresentation = z.object({
|
|
67
|
+
kind: z.literal("approval"),
|
|
68
|
+
decisionField: z.string().min(1),
|
|
69
|
+
feedbackField: z.string().min(1).optional(),
|
|
70
|
+
});
|
|
71
|
+
|
|
66
72
|
/**
|
|
67
73
|
* agent emit 的指令(skill 教)——和 interaction.request 结构基本一致,
|
|
68
74
|
* 但不带 requestId(由 phonon 生成)。
|
|
@@ -80,9 +86,17 @@ export type InteractionDirective = z.infer<typeof InteractionDirective>;
|
|
|
80
86
|
export const InteractionRequestParams = z.object({
|
|
81
87
|
/** 本次交互唯一 id,response 用它配对。 */
|
|
82
88
|
requestId: z.string().min(1),
|
|
89
|
+
/** Trusted workflow attribution supplied by the device controller, not parsed from form prose. */
|
|
90
|
+
workflowId: z.string().optional(),
|
|
91
|
+
/** Stamped by the controller from the current native Session/Workflow. */
|
|
92
|
+
nativeRunId: z.string().uuid().optional(),
|
|
93
|
+
/** Canonical Dev Run identity; mutually exclusive with nativeRunId. */
|
|
94
|
+
devRunId: z.string().uuid().optional(),
|
|
83
95
|
sessionId: SessionId.optional(),
|
|
84
96
|
turnId: z.string().optional(),
|
|
85
97
|
form: InteractionForm,
|
|
98
|
+
/** Agent-selected rendering hint; never an app-selected approval policy. */
|
|
99
|
+
presentation: InteractionPresentation.optional(),
|
|
86
100
|
blocking: z.boolean().default(true),
|
|
87
101
|
/** 关联 hookId(HITL 场景)。 */
|
|
88
102
|
hookId: z.string().optional(),
|
|
@@ -92,7 +106,7 @@ export const InteractionRequestParams = z.object({
|
|
|
92
106
|
*/
|
|
93
107
|
timeoutSeconds: z.number().int().nonnegative().optional(),
|
|
94
108
|
at: Timestamp,
|
|
95
|
-
});
|
|
109
|
+
}).refine(value=>!(value.nativeRunId&&value.devRunId),"interaction source domains cannot be mixed");
|
|
96
110
|
export type InteractionRequestParams = z.infer<typeof InteractionRequestParams>;
|
|
97
111
|
|
|
98
112
|
/** 人机交互的生命周期状态(P1-5):pending → submitted | cancelled | timeout。 */
|
|
@@ -109,6 +123,23 @@ export const InteractionRequestResult = z.object({
|
|
|
109
123
|
});
|
|
110
124
|
export type InteractionRequestResult = z.infer<typeof InteractionRequestResult>;
|
|
111
125
|
|
|
126
|
+
export const InteractionReceiptState = z.enum(["pending", "delivered", "applied", "cancelled", "timeout", "failed", "unknown"]);
|
|
127
|
+
export const InteractionStatusParams = z.object({ requestId: z.string().min(1).max(512) });
|
|
128
|
+
export const InteractionStatusResult = z.object({
|
|
129
|
+
requestId: z.string(), requestHash: z.string().regex(/^[a-f0-9]{64}$/), state: InteractionReceiptState,
|
|
130
|
+
nativeRunId: z.string().uuid().optional(), workflowId: z.string().optional(), sessionId: SessionId.optional(), turnId: z.string().optional(),
|
|
131
|
+
devRunId:z.string().uuid().optional(),
|
|
132
|
+
decisionHash: z.string().regex(/^[a-f0-9]{64}$/).optional(), updatedAt: Timestamp,
|
|
133
|
+
}).refine(value=>!(value.nativeRunId&&value.devRunId),"interaction source domains cannot be mixed");
|
|
134
|
+
export type InteractionStatusResult = z.infer<typeof InteractionStatusResult>;
|
|
135
|
+
|
|
136
|
+
/** Timestamp-independent identity shared by durable request/replay consumers. */
|
|
137
|
+
export function interactionRequestIdentity(params: InteractionRequestParams) {
|
|
138
|
+
return { requestId: params.requestId, nativeRunId: params.nativeRunId, devRunId:params.devRunId, workflowId: params.workflowId,
|
|
139
|
+
sessionId: params.sessionId, turnId: params.turnId, form: params.form, presentation: params.presentation,
|
|
140
|
+
blocking: params.blocking, timeoutSeconds: params.timeoutSeconds, hookId: params.hookId };
|
|
141
|
+
}
|
|
142
|
+
|
|
112
143
|
// --- interaction.cancel(server → phonon 或 phonon 内部):主动取消一个 pending 交互 ---
|
|
113
144
|
export const InteractionCancelParams = z.object({
|
|
114
145
|
requestId: z.string().min(1),
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Timestamp } from "./common.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Deterministic host-maintenance plane.
|
|
6
|
+
*
|
|
7
|
+
* Requests address locally configured target/config/service ids; the server can
|
|
8
|
+
* never supply raw host paths, package names, service names, or shell strings.
|
|
9
|
+
* Device policy remains authoritative for every action.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const MaintenancePermission = z.object({
|
|
13
|
+
read: z.boolean(),
|
|
14
|
+
configWrite: z.boolean(),
|
|
15
|
+
packageUpdate: z.boolean(),
|
|
16
|
+
serviceRestart: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
export type MaintenancePermission = z.infer<typeof MaintenancePermission>;
|
|
19
|
+
|
|
20
|
+
export const MaintenanceConfigFormat = z.enum(["json", "jsonc", "yaml", "toml", "text"]);
|
|
21
|
+
export type MaintenanceConfigFormat = z.infer<typeof MaintenanceConfigFormat>;
|
|
22
|
+
|
|
23
|
+
export const MaintenanceConfigDescriptor = z.object({
|
|
24
|
+
configId: z.string().min(1),
|
|
25
|
+
label: z.string().optional(),
|
|
26
|
+
format: MaintenanceConfigFormat,
|
|
27
|
+
textVisibility: z.enum(["hidden", "public"]).optional(),
|
|
28
|
+
wholeFileWritable: z.boolean().optional(),
|
|
29
|
+
allowedRootKeys: z.array(z.string()).optional(),
|
|
30
|
+
exists: z.boolean(),
|
|
31
|
+
writable: z.boolean(),
|
|
32
|
+
});
|
|
33
|
+
export type MaintenanceConfigDescriptor = z.infer<typeof MaintenanceConfigDescriptor>;
|
|
34
|
+
|
|
35
|
+
export const MaintenanceServiceDescriptor = z.object({
|
|
36
|
+
serviceId: z.string().min(1),
|
|
37
|
+
label: z.string().optional(),
|
|
38
|
+
configured: z.boolean(),
|
|
39
|
+
});
|
|
40
|
+
export type MaintenanceServiceDescriptor = z.infer<typeof MaintenanceServiceDescriptor>;
|
|
41
|
+
|
|
42
|
+
export const MaintenanceTargetDescriptor = z.object({
|
|
43
|
+
targetId: z.string().min(1),
|
|
44
|
+
label: z.string(),
|
|
45
|
+
command: z.string().optional(),
|
|
46
|
+
packageUpdateConfigured: z.boolean(),
|
|
47
|
+
configs: z.array(MaintenanceConfigDescriptor),
|
|
48
|
+
services: z.array(MaintenanceServiceDescriptor),
|
|
49
|
+
});
|
|
50
|
+
export type MaintenanceTargetDescriptor = z.infer<typeof MaintenanceTargetDescriptor>;
|
|
51
|
+
|
|
52
|
+
export const MaintenanceTargetsParams = z.object({}).strict();
|
|
53
|
+
export const MaintenanceTargetsResult = z.object({
|
|
54
|
+
permissions: MaintenancePermission,
|
|
55
|
+
targets: z.array(MaintenanceTargetDescriptor),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const MaintenanceDiagnoseParams = z.object({
|
|
59
|
+
targetId: z.string().min(1).optional(),
|
|
60
|
+
}).strict();
|
|
61
|
+
export const MaintenanceDiagnostic = z.object({
|
|
62
|
+
targetId: z.string(),
|
|
63
|
+
available: z.boolean(),
|
|
64
|
+
version: z.string().optional(),
|
|
65
|
+
versionError: z.string().optional(),
|
|
66
|
+
configs: z.array(z.object({
|
|
67
|
+
configId: z.string(),
|
|
68
|
+
exists: z.boolean(),
|
|
69
|
+
valid: z.boolean().optional(),
|
|
70
|
+
sha256: z.string().optional(),
|
|
71
|
+
error: z.string().optional(),
|
|
72
|
+
})),
|
|
73
|
+
services: z.array(z.object({
|
|
74
|
+
serviceId: z.string(),
|
|
75
|
+
status: z.enum(["running", "stopped", "unknown", "not_configured"]),
|
|
76
|
+
detail: z.string().optional(),
|
|
77
|
+
})),
|
|
78
|
+
});
|
|
79
|
+
export const MaintenanceDiagnoseResult = z.object({
|
|
80
|
+
diagnostics: z.array(MaintenanceDiagnostic),
|
|
81
|
+
at: Timestamp,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export const MaintenanceConfigGetParams = z.object({
|
|
85
|
+
targetId: z.string().min(1),
|
|
86
|
+
configId: z.string().min(1),
|
|
87
|
+
}).strict();
|
|
88
|
+
export const MaintenanceConfigGetResult = z.object({
|
|
89
|
+
targetId: z.string(),
|
|
90
|
+
configId: z.string(),
|
|
91
|
+
exists: z.boolean(),
|
|
92
|
+
sha256: z.string().optional(),
|
|
93
|
+
format: MaintenanceConfigFormat.optional(),
|
|
94
|
+
text: z.string().optional(),
|
|
95
|
+
textWithheld: z.boolean().optional(),
|
|
96
|
+
/** Parsed value with secret-looking fields recursively redacted; TOML special types use tagged diagnostic projections. */
|
|
97
|
+
value: z.unknown().optional(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const MaintenanceConfigPatchParams = z.object({
|
|
101
|
+
targetId: z.string().min(1),
|
|
102
|
+
configId: z.string().min(1),
|
|
103
|
+
/** Optimistic lock from maintenance.config.get. Required to prevent stale overwrite. */
|
|
104
|
+
expectedSha256: z.string().min(1),
|
|
105
|
+
/** RFC 7396-style JSON merge patch. Arrays are replaced as a whole. */
|
|
106
|
+
patch: z.record(z.unknown()),
|
|
107
|
+
reason: z.string().max(500).optional(),
|
|
108
|
+
clientRequestId: z.string().optional(),
|
|
109
|
+
}).strict();
|
|
110
|
+
export const MaintenanceConfigPatchResult = z.object({
|
|
111
|
+
targetId: z.string(),
|
|
112
|
+
configId: z.string(),
|
|
113
|
+
format: MaintenanceConfigFormat.optional(),
|
|
114
|
+
changed: z.boolean(),
|
|
115
|
+
previousSha256: z.string(),
|
|
116
|
+
sha256: z.string(),
|
|
117
|
+
backupId: z.string().optional(),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export const MaintenanceConfigEditParams = z.object({
|
|
121
|
+
targetId: z.string().min(1),
|
|
122
|
+
configId: z.string().min(1),
|
|
123
|
+
expectedSha256: z.string().min(1),
|
|
124
|
+
edits: z.array(z.object({ oldText: z.string().min(1).max(1048576), newText: z.string().max(1048576) }).strict()).min(1).max(100),
|
|
125
|
+
reason: z.string().max(500).optional(),
|
|
126
|
+
clientRequestId: z.string().optional(),
|
|
127
|
+
}).strict();
|
|
128
|
+
export const MaintenanceConfigEditResult = MaintenanceConfigPatchResult;
|
|
129
|
+
export type MaintenanceConfigEditParams = z.infer<typeof MaintenanceConfigEditParams>;
|
|
130
|
+
export type MaintenanceConfigEditResult = z.infer<typeof MaintenanceConfigEditResult>;
|
|
131
|
+
|
|
132
|
+
export const MaintenanceRollbackParams = z.object({
|
|
133
|
+
backupId: z.string().min(1).regex(/^[A-Za-z0-9._-]+$/),
|
|
134
|
+
/** Current config hash, preventing a stale rollback from clobbering later edits. */
|
|
135
|
+
expectedCurrentSha256: z.string().min(1),
|
|
136
|
+
reason: z.string().max(500).optional(),
|
|
137
|
+
clientRequestId: z.string().optional(),
|
|
138
|
+
}).strict();
|
|
139
|
+
export const MaintenanceRollbackResult = z.object({
|
|
140
|
+
backupId: z.string(),
|
|
141
|
+
targetId: z.string(),
|
|
142
|
+
configId: z.string(),
|
|
143
|
+
restored: z.literal(true),
|
|
144
|
+
sha256: z.string(),
|
|
145
|
+
/** Backup of the state replaced by rollback, allowing an immediate roll-forward. */
|
|
146
|
+
reversibleBackupId: z.string().optional(),
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
export const MaintenancePackageUpdateParams = z.object({
|
|
150
|
+
targetId: z.string().min(1),
|
|
151
|
+
version: z.string().min(1).max(100).optional(),
|
|
152
|
+
clientRequestId: z.string().optional(),
|
|
153
|
+
}).strict();
|
|
154
|
+
export const MaintenancePackageUpdateResult = z.object({
|
|
155
|
+
targetId: z.string(),
|
|
156
|
+
manager: z.enum(["npm", "pnpm"]),
|
|
157
|
+
packageName: z.string(),
|
|
158
|
+
requestedVersion: z.string(),
|
|
159
|
+
exitCode: z.number().int(),
|
|
160
|
+
stdout: z.string(),
|
|
161
|
+
stderr: z.string(),
|
|
162
|
+
versionAfter: z.string().optional(),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export const MaintenanceServiceStatusParams = z.object({
|
|
166
|
+
targetId: z.string().min(1),
|
|
167
|
+
serviceId: z.string().min(1),
|
|
168
|
+
}).strict();
|
|
169
|
+
export const MaintenanceServiceStatusResult = z.object({
|
|
170
|
+
targetId: z.string(),
|
|
171
|
+
serviceId: z.string(),
|
|
172
|
+
status: z.enum(["running", "stopped", "unknown", "not_configured"]),
|
|
173
|
+
detail: z.string().optional(),
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
export const MaintenanceServiceRestartParams = z.object({
|
|
177
|
+
targetId: z.string().min(1),
|
|
178
|
+
serviceId: z.string().min(1),
|
|
179
|
+
clientRequestId: z.string().optional(),
|
|
180
|
+
}).strict();
|
|
181
|
+
export const MaintenanceServiceRestartResult = z.object({
|
|
182
|
+
targetId: z.string(),
|
|
183
|
+
serviceId: z.string(),
|
|
184
|
+
restarted: z.boolean(),
|
|
185
|
+
status: z.enum(["running", "stopped", "unknown", "not_configured"]),
|
|
186
|
+
detail: z.string().optional(),
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
export type MaintenanceTargetsParams = z.infer<typeof MaintenanceTargetsParams>;
|
|
190
|
+
export type MaintenanceTargetsResult = z.infer<typeof MaintenanceTargetsResult>;
|
|
191
|
+
export type MaintenanceDiagnoseParams = z.infer<typeof MaintenanceDiagnoseParams>;
|
|
192
|
+
export type MaintenanceDiagnoseResult = z.infer<typeof MaintenanceDiagnoseResult>;
|
|
193
|
+
export type MaintenanceConfigGetParams = z.infer<typeof MaintenanceConfigGetParams>;
|
|
194
|
+
export type MaintenanceConfigGetResult = z.infer<typeof MaintenanceConfigGetResult>;
|
|
195
|
+
export type MaintenanceConfigPatchParams = z.infer<typeof MaintenanceConfigPatchParams>;
|
|
196
|
+
export type MaintenanceConfigPatchResult = z.infer<typeof MaintenanceConfigPatchResult>;
|
|
197
|
+
export type MaintenanceRollbackParams = z.infer<typeof MaintenanceRollbackParams>;
|
|
198
|
+
export type MaintenanceRollbackResult = z.infer<typeof MaintenanceRollbackResult>;
|
|
199
|
+
export type MaintenancePackageUpdateParams = z.infer<typeof MaintenancePackageUpdateParams>;
|
|
200
|
+
export type MaintenancePackageUpdateResult = z.infer<typeof MaintenancePackageUpdateResult>;
|
|
201
|
+
export type MaintenanceServiceStatusParams = z.infer<typeof MaintenanceServiceStatusParams>;
|
|
202
|
+
export type MaintenanceServiceStatusResult = z.infer<typeof MaintenanceServiceStatusResult>;
|
|
203
|
+
export type MaintenanceServiceRestartParams = z.infer<typeof MaintenanceServiceRestartParams>;
|
|
204
|
+
export type MaintenanceServiceRestartResult = z.infer<typeof MaintenanceServiceRestartResult>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ManagedMcpBinding = z.object({
|
|
4
|
+
id: z.string().uuid(),
|
|
5
|
+
agentId: z.string().min(1).max(255),
|
|
6
|
+
enabled: z.boolean(),
|
|
7
|
+
}).strict();
|
|
8
|
+
export const ManagedMcpConfigureParams = z.object({
|
|
9
|
+
revision: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
|
|
10
|
+
bindings: z.array(ManagedMcpBinding).max(50),
|
|
11
|
+
}).strict().refine(value => new Set(value.bindings.map(item => item.id)).size === value.bindings.length
|
|
12
|
+
&& new Set(value.bindings.map(item => item.agentId)).size === value.bindings.length, "duplicate MCP binding");
|
|
13
|
+
export const ManagedMcpStatusParams = z.object({}).strict();
|
|
14
|
+
export const ManagedMcpBindingStatus = z.object({
|
|
15
|
+
id: z.string().uuid(), agentId: z.string().min(1).max(255),
|
|
16
|
+
state: z.enum(["configured", "removed", "conflict", "unsupported", "local_consent_required", "error"]),
|
|
17
|
+
code: z.string().regex(/^[a-z0-9_]{1,100}$/).optional(),
|
|
18
|
+
}).strict();
|
|
19
|
+
export const ManagedMcpStatusResult = z.object({
|
|
20
|
+
revision: z.number().int().min(-1),
|
|
21
|
+
allowed: z.boolean(),
|
|
22
|
+
bindings: z.array(ManagedMcpBindingStatus).max(50),
|
|
23
|
+
}).strict();
|
|
24
|
+
export type ManagedMcpConfigureParams = z.infer<typeof ManagedMcpConfigureParams>;
|
|
25
|
+
export type ManagedMcpStatusResult = z.infer<typeof ManagedMcpStatusResult>;
|