@zixt/host 0.0.102 → 0.0.103
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/index.js +161 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import { homedir as homedir3 } from "node:os";
|
|
|
28
28
|
// package.json
|
|
29
29
|
var package_default = {
|
|
30
30
|
name: "@zixt/host",
|
|
31
|
-
version: "0.0.
|
|
31
|
+
version: "0.0.103",
|
|
32
32
|
type: "module",
|
|
33
33
|
exports: {
|
|
34
34
|
".": "./src/client.ts",
|
|
@@ -14672,6 +14672,8 @@ var ID_PREFIXES = {
|
|
|
14672
14672
|
managerApiAction: "maa",
|
|
14673
14673
|
/** One Manager-prepared Webhook Automation setup card (MG-21). */
|
|
14674
14674
|
managerWebhookAction: "mwa",
|
|
14675
|
+
/** One Manager-authored questionnaire waiting in a Conversation. */
|
|
14676
|
+
managerQuestionnaire: "mqu",
|
|
14675
14677
|
/** One Manager inference call's token-metering row (MG-8). */
|
|
14676
14678
|
managerUsage: "mgu",
|
|
14677
14679
|
/** One ordered Manager reply awaiting Slack delivery. */
|
|
@@ -14739,6 +14741,10 @@ var ManagerWebhookActionId = idSchema(
|
|
|
14739
14741
|
ID_PREFIXES.managerWebhookAction,
|
|
14740
14742
|
"Manager webhook action id"
|
|
14741
14743
|
);
|
|
14744
|
+
var ManagerQuestionnaireId = idSchema(
|
|
14745
|
+
ID_PREFIXES.managerQuestionnaire,
|
|
14746
|
+
"Manager questionnaire id"
|
|
14747
|
+
);
|
|
14742
14748
|
var ManagerEmailInboxId = idSchema(
|
|
14743
14749
|
ID_PREFIXES.managerEmailInbox,
|
|
14744
14750
|
"Manager email inbox id"
|
|
@@ -14982,7 +14988,9 @@ var MemberApprovalRequestContext = ApprovalRequestContext.extend({
|
|
|
14982
14988
|
});
|
|
14983
14989
|
var QuestionChoice = external_exports.object({
|
|
14984
14990
|
label: external_exports.string().trim().min(1).max(120),
|
|
14985
|
-
description: external_exports.string().trim().min(1).max(500).optional()
|
|
14991
|
+
description: external_exports.string().trim().min(1).max(500).optional(),
|
|
14992
|
+
/** At most one choice per question may carry this visual recommendation. */
|
|
14993
|
+
recommended: external_exports.boolean().optional()
|
|
14986
14994
|
}).strict();
|
|
14987
14995
|
var QuestionChoices = external_exports.array(QuestionChoice).min(2).max(5).superRefine((choices, ctx) => {
|
|
14988
14996
|
const labels = choices.map(({ label }) => label.toLocaleLowerCase());
|
|
@@ -14990,6 +14998,38 @@ var QuestionChoices = external_exports.array(QuestionChoice).min(2).max(5).super
|
|
|
14990
14998
|
ctx.addIssue({ code: "custom", message: "question choice labels must be unique" });
|
|
14991
14999
|
}
|
|
14992
15000
|
});
|
|
15001
|
+
var QuestionnaireQuestion = external_exports.object({
|
|
15002
|
+
/** Stable model-authored key used only to pair an answer with this snapshot. */
|
|
15003
|
+
id: external_exports.string().trim().min(1).max(80),
|
|
15004
|
+
question: external_exports.string().trim().min(1).max(500),
|
|
15005
|
+
context: external_exports.string().trim().min(1).max(2e3).optional(),
|
|
15006
|
+
/** False is A/B/C/D radio behavior; true permits several choices plus Other. */
|
|
15007
|
+
allowMultiple: external_exports.boolean(),
|
|
15008
|
+
choices: QuestionChoices
|
|
15009
|
+
}).strict().superRefine((question, ctx) => {
|
|
15010
|
+
if (question.choices.filter((choice) => choice.recommended === true).length > 1) {
|
|
15011
|
+
ctx.addIssue({
|
|
15012
|
+
code: "custom",
|
|
15013
|
+
path: ["choices"],
|
|
15014
|
+
message: "a questionnaire question may have at most one recommended choice"
|
|
15015
|
+
});
|
|
15016
|
+
}
|
|
15017
|
+
});
|
|
15018
|
+
var Questionnaire = external_exports.object({
|
|
15019
|
+
title: external_exports.string().trim().min(1).max(160).optional(),
|
|
15020
|
+
questions: external_exports.array(QuestionnaireQuestion).min(1).max(4)
|
|
15021
|
+
}).strict().superRefine((questionnaire, ctx) => {
|
|
15022
|
+
const ids = questionnaire.questions.map(({ id }) => id.toLocaleLowerCase());
|
|
15023
|
+
if (new Set(ids).size !== ids.length) {
|
|
15024
|
+
ctx.addIssue({ code: "custom", path: ["questions"], message: "question ids must be unique" });
|
|
15025
|
+
}
|
|
15026
|
+
});
|
|
15027
|
+
var QuestionnaireAnswer = external_exports.object({
|
|
15028
|
+
questionId: external_exports.string().trim().min(1).max(80),
|
|
15029
|
+
selectedChoices: external_exports.array(external_exports.string().trim().min(1).max(120)).max(5),
|
|
15030
|
+
other: external_exports.string().trim().min(1).max(1e4).optional()
|
|
15031
|
+
}).strict();
|
|
15032
|
+
var QuestionnaireAnswers = external_exports.array(QuestionnaireAnswer).min(1).max(4);
|
|
14993
15033
|
var Approval = external_exports.object({
|
|
14994
15034
|
id: ApprovalId,
|
|
14995
15035
|
orgId: OrgId,
|
|
@@ -15002,6 +15042,10 @@ var Approval = external_exports.object({
|
|
|
15002
15042
|
payload: external_exports.string().max(5e4),
|
|
15003
15043
|
/** Present only when ask_user supplied a bounded multiple-choice question. */
|
|
15004
15044
|
questionChoices: QuestionChoices.optional(),
|
|
15045
|
+
/** Present when ask_user supplied one submit-once multi-question questionnaire. */
|
|
15046
|
+
questionnaire: Questionnaire.optional(),
|
|
15047
|
+
/** Exact submitted questionnaire response, once answered. */
|
|
15048
|
+
questionnaireAnswers: QuestionnaireAnswers.optional(),
|
|
15005
15049
|
status: ApprovalStatus,
|
|
15006
15050
|
deliveryStatus: ApprovalDeliveryStatus,
|
|
15007
15051
|
/** Why delivery became impossible; null while pending or after delivery. */
|
|
@@ -15038,7 +15082,8 @@ var ApprovalProjection = external_exports.discriminatedUnion("metadataRedacted",
|
|
|
15038
15082
|
var ListApprovalsResponse = external_exports.object({ approvals: external_exports.array(ApprovalProjection) });
|
|
15039
15083
|
var DecideApprovalRequest = external_exports.object({
|
|
15040
15084
|
decision: external_exports.enum(["approve", "deny"]),
|
|
15041
|
-
guidance: external_exports.string().max(1e4).optional()
|
|
15085
|
+
guidance: external_exports.string().max(1e4).optional(),
|
|
15086
|
+
questionnaireAnswers: QuestionnaireAnswers.optional()
|
|
15042
15087
|
});
|
|
15043
15088
|
var UpdateGuardrailsRequest = external_exports.object({ policy: GuardrailPolicy });
|
|
15044
15089
|
|
|
@@ -17999,7 +18044,9 @@ var ApprovalDecision = external_exports.object({
|
|
|
17999
18044
|
/** Echo of the host-minted correlation id from approval.request. */
|
|
18000
18045
|
requestId: external_exports.string(),
|
|
18001
18046
|
decision: external_exports.enum(["approve", "deny"]),
|
|
18002
|
-
guidance: external_exports.string().nullable()
|
|
18047
|
+
guidance: external_exports.string().nullable(),
|
|
18048
|
+
/** Exact structured response when the request carried a questionnaire. */
|
|
18049
|
+
questionnaireAnswers: QuestionnaireAnswers.optional()
|
|
18003
18050
|
});
|
|
18004
18051
|
var ResolvedConnection = external_exports.object({
|
|
18005
18052
|
connectionId: external_exports.string(),
|
|
@@ -18568,7 +18615,9 @@ var ApprovalRequest = external_exports.object({
|
|
|
18568
18615
|
/** Concrete action payload rendered verbatim on the approval card (GR-3). */
|
|
18569
18616
|
payload: external_exports.string().max(5e4),
|
|
18570
18617
|
/** Optional structured answers for agent.question; absent means free text. */
|
|
18571
|
-
questionChoices: QuestionChoices.optional()
|
|
18618
|
+
questionChoices: QuestionChoices.optional(),
|
|
18619
|
+
/** Optional submit-once questionnaire for agent.question. */
|
|
18620
|
+
questionnaire: Questionnaire.optional()
|
|
18572
18621
|
});
|
|
18573
18622
|
var JournalAppend = external_exports.object({
|
|
18574
18623
|
type: external_exports.literal("journal.append"),
|
|
@@ -19065,7 +19114,9 @@ var ConversationEventProjection = external_exports.discriminatedUnion("kind", [
|
|
|
19065
19114
|
/** Present only for a generic API setup/invocation card; never credentials (MG-20). */
|
|
19066
19115
|
apiActionId: ManagerApiActionId.nullable().optional(),
|
|
19067
19116
|
/** Present only for a Webhook Automation secure setup card (MG-21). */
|
|
19068
|
-
webhookActionId: ManagerWebhookActionId.nullable().optional()
|
|
19117
|
+
webhookActionId: ManagerWebhookActionId.nullable().optional(),
|
|
19118
|
+
/** Present only for a Manager-authored questionnaire (MG-22). */
|
|
19119
|
+
questionnaireId: ManagerQuestionnaireId.nullable().optional()
|
|
19069
19120
|
}).strict(),
|
|
19070
19121
|
/** A mirrored child-Task event: what the teammate wrote or became. */
|
|
19071
19122
|
external_exports.object({
|
|
@@ -19087,7 +19138,9 @@ var ConversationEventProjection = external_exports.discriminatedUnion("kind", [
|
|
|
19087
19138
|
* render one outcome when recovery commits those records out of order.
|
|
19088
19139
|
* Missing on legacy/non-terminal events.
|
|
19089
19140
|
*/
|
|
19090
|
-
terminalGroup: external_exports.string().min(1).max(200).nullable().optional()
|
|
19141
|
+
terminalGroup: external_exports.string().min(1).max(200).nullable().optional(),
|
|
19142
|
+
/** Present when this teammate question has a structured answer card. */
|
|
19143
|
+
approvalId: ApprovalId.nullable().optional()
|
|
19091
19144
|
}).strict(),
|
|
19092
19145
|
/** A Manager loop failure a person should see (provider outage, refusal). */
|
|
19093
19146
|
external_exports.object({
|
|
@@ -19310,6 +19363,20 @@ var SubmitManagerWebhookActionRequest = external_exports.object({
|
|
|
19310
19363
|
requestId: external_exports.uuid(),
|
|
19311
19364
|
authentication: WebhookAuthenticationSetup
|
|
19312
19365
|
}).strict();
|
|
19366
|
+
var ConversationQuestionnaireProjection = external_exports.object({
|
|
19367
|
+
id: external_exports.union([ManagerQuestionnaireId, ApprovalId]),
|
|
19368
|
+
conversationId: ConversationId,
|
|
19369
|
+
source: external_exports.enum(["manager", "teammate"]),
|
|
19370
|
+
taskId: TaskId.nullable(),
|
|
19371
|
+
agentId: AgentId.nullable(),
|
|
19372
|
+
questionnaire: Questionnaire,
|
|
19373
|
+
status: external_exports.enum(["pending", "answered", "unavailable"]),
|
|
19374
|
+
answers: QuestionnaireAnswers.nullable(),
|
|
19375
|
+
unavailableReason: external_exports.string().max(2e3).nullable(),
|
|
19376
|
+
createdAt: external_exports.string(),
|
|
19377
|
+
answeredAt: external_exports.string().nullable()
|
|
19378
|
+
}).strict();
|
|
19379
|
+
var AnswerConversationQuestionnaireRequest = external_exports.object({ answers: QuestionnaireAnswers }).strict();
|
|
19313
19380
|
var NonEmptyTaskRunnerSelection = TaskRunnerSelection.refine(
|
|
19314
19381
|
(selection) => selection.type !== void 0 || selection.model !== void 0 || selection.effort !== void 0,
|
|
19315
19382
|
"choose at least one runtime preference"
|
|
@@ -23916,7 +23983,7 @@ var HostClient = class _HostClient {
|
|
|
23916
23983
|
const { provider: _provider, ...legacyGrant } = grant;
|
|
23917
23984
|
return legacyGrant;
|
|
23918
23985
|
};
|
|
23919
|
-
const requestApproval = (category, summary, payload, questionChoices) => {
|
|
23986
|
+
const requestApproval = (category, summary, payload, questionChoices, questionnaire) => {
|
|
23920
23987
|
if (authorityController.signal.aborted) {
|
|
23921
23988
|
return Promise.resolve({ approved: false, guidance: "task was cancelled" });
|
|
23922
23989
|
}
|
|
@@ -23929,7 +23996,8 @@ var HostClient = class _HostClient {
|
|
|
23929
23996
|
category: safe(category, 200),
|
|
23930
23997
|
summary: safe(summary, 500),
|
|
23931
23998
|
payload: safe(payload, 5e4),
|
|
23932
|
-
...questionChoices ? { questionChoices: [...questionChoices] } : {}
|
|
23999
|
+
...questionChoices ? { questionChoices: [...questionChoices] } : {},
|
|
24000
|
+
...questionnaire ? { questionnaire } : {}
|
|
23933
24001
|
});
|
|
23934
24002
|
return new Promise((resolve18) => {
|
|
23935
24003
|
const waiters = this.approvalWaiters.get(cancelKey) ?? /* @__PURE__ */ new Map();
|
|
@@ -35985,7 +36053,7 @@ var CADENCE_PROPS = {
|
|
|
35985
36053
|
var TOOLS = [
|
|
35986
36054
|
{
|
|
35987
36055
|
name: "ask_user",
|
|
35988
|
-
description: "Ask the human supervising this task a question and wait for their answer. Use it whenever you need a decision, missing context, or plan approval before proceeding.
|
|
36056
|
+
description: "Ask the human supervising this task a question and wait for their answer. Use it whenever you need a decision, missing context, or plan approval before proceeding. Use questions whenever there are concrete alternatives, including when there is only one decision: each question needs 2-5 choices, may permit multiple selections, and may mark one choice recommended. Do not ask the questions one at a time. The person can always enter another answer, and all submitted answers arrive together as text. Use question without choices only for a genuinely free-text answer. For a credential, ask for the capability rather than the value: a Credential added under Resources reaches your next run as an environment variable and is scrubbed from everything you write, and a website sign-in belongs at the Browser panel. If the person chooses to send you a value here anyway, use it for this task and store it with set_secret if it should persist, but never print it, write it into a file you commit, or repeat it in your report.",
|
|
35989
36057
|
inputSchema: {
|
|
35990
36058
|
type: "object",
|
|
35991
36059
|
properties: {
|
|
@@ -36013,14 +36081,63 @@ var TOOLS = [
|
|
|
36013
36081
|
minLength: 1,
|
|
36014
36082
|
maxLength: 500,
|
|
36015
36083
|
description: "Optional consequence or detail that helps the person choose."
|
|
36084
|
+
},
|
|
36085
|
+
recommended: {
|
|
36086
|
+
type: "boolean",
|
|
36087
|
+
description: "True for the one choice you recommend; omit for all others."
|
|
36016
36088
|
}
|
|
36017
36089
|
},
|
|
36018
36090
|
required: ["label"],
|
|
36019
36091
|
additionalProperties: false
|
|
36020
36092
|
}
|
|
36093
|
+
},
|
|
36094
|
+
title: {
|
|
36095
|
+
type: "string",
|
|
36096
|
+
minLength: 1,
|
|
36097
|
+
maxLength: 160,
|
|
36098
|
+
description: "Optional short heading when using questions."
|
|
36099
|
+
},
|
|
36100
|
+
questions: {
|
|
36101
|
+
type: "array",
|
|
36102
|
+
minItems: 1,
|
|
36103
|
+
maxItems: 4,
|
|
36104
|
+
description: "A submit-once questionnaire. Use instead of question/context/choices when several related answers are needed.",
|
|
36105
|
+
items: {
|
|
36106
|
+
type: "object",
|
|
36107
|
+
properties: {
|
|
36108
|
+
id: {
|
|
36109
|
+
type: "string",
|
|
36110
|
+
minLength: 1,
|
|
36111
|
+
maxLength: 80,
|
|
36112
|
+
description: "A unique stable key such as deployment_target."
|
|
36113
|
+
},
|
|
36114
|
+
question: { type: "string", minLength: 1, maxLength: 500 },
|
|
36115
|
+
context: { type: "string", minLength: 1, maxLength: 2e3 },
|
|
36116
|
+
allow_multiple: {
|
|
36117
|
+
type: "boolean",
|
|
36118
|
+
description: "True when the person may select several choices."
|
|
36119
|
+
},
|
|
36120
|
+
choices: {
|
|
36121
|
+
type: "array",
|
|
36122
|
+
minItems: 2,
|
|
36123
|
+
maxItems: 5,
|
|
36124
|
+
items: {
|
|
36125
|
+
type: "object",
|
|
36126
|
+
properties: {
|
|
36127
|
+
label: { type: "string", minLength: 1, maxLength: 120 },
|
|
36128
|
+
description: { type: "string", minLength: 1, maxLength: 500 },
|
|
36129
|
+
recommended: { type: "boolean" }
|
|
36130
|
+
},
|
|
36131
|
+
required: ["label"],
|
|
36132
|
+
additionalProperties: false
|
|
36133
|
+
}
|
|
36134
|
+
}
|
|
36135
|
+
},
|
|
36136
|
+
required: ["id", "question", "allow_multiple", "choices"],
|
|
36137
|
+
additionalProperties: false
|
|
36138
|
+
}
|
|
36021
36139
|
}
|
|
36022
36140
|
},
|
|
36023
|
-
required: ["question"],
|
|
36024
36141
|
additionalProperties: false
|
|
36025
36142
|
}
|
|
36026
36143
|
},
|
|
@@ -36652,7 +36769,8 @@ function createAskUserServer() {
|
|
|
36652
36769
|
const args = rpc.params?.["arguments"] ?? {};
|
|
36653
36770
|
if (surface.platform && name === "ask_user") {
|
|
36654
36771
|
const question = typeof args["question"] === "string" ? args["question"] : "";
|
|
36655
|
-
|
|
36772
|
+
const rawQuestions = args["questions"];
|
|
36773
|
+
if (!question && !Array.isArray(rawQuestions)) {
|
|
36656
36774
|
reply(200, {
|
|
36657
36775
|
jsonrpc: "2.0",
|
|
36658
36776
|
id: rpc.id ?? null,
|
|
@@ -36671,11 +36789,37 @@ function createAskUserServer() {
|
|
|
36671
36789
|
);
|
|
36672
36790
|
return;
|
|
36673
36791
|
}
|
|
36792
|
+
const rawQuestionnaire = Array.isArray(rawQuestions) ? {
|
|
36793
|
+
...typeof args["title"] === "string" ? { title: args["title"] } : {},
|
|
36794
|
+
questions: rawQuestions.map((entry) => {
|
|
36795
|
+
const candidate = typeof entry === "object" && entry !== null ? entry : {};
|
|
36796
|
+
return {
|
|
36797
|
+
id: candidate["id"],
|
|
36798
|
+
question: candidate["question"],
|
|
36799
|
+
...candidate["context"] === void 0 ? {} : { context: candidate["context"] },
|
|
36800
|
+
allowMultiple: candidate["allow_multiple"],
|
|
36801
|
+
choices: candidate["choices"]
|
|
36802
|
+
};
|
|
36803
|
+
})
|
|
36804
|
+
} : void 0;
|
|
36805
|
+
const parsedQuestionnaire = rawQuestionnaire === void 0 ? void 0 : Questionnaire.safeParse(rawQuestionnaire);
|
|
36806
|
+
if (parsedQuestionnaire && !parsedQuestionnaire.success) {
|
|
36807
|
+
toolText(
|
|
36808
|
+
"Questions must contain 1-4 unique items, each with 2-5 unique choices and at most one recommendation.",
|
|
36809
|
+
true
|
|
36810
|
+
);
|
|
36811
|
+
return;
|
|
36812
|
+
}
|
|
36813
|
+
if (parsedQuestionnaire?.success && (question || rawChoices !== void 0)) {
|
|
36814
|
+
toolText("Use either question/choices or questions, not both.", true);
|
|
36815
|
+
return;
|
|
36816
|
+
}
|
|
36674
36817
|
toolText(
|
|
36675
36818
|
await handlers.askUser(
|
|
36676
|
-
question,
|
|
36819
|
+
question || parsedQuestionnaire?.data.title || parsedQuestionnaire?.data.questions[0].question || "A few questions",
|
|
36677
36820
|
context,
|
|
36678
|
-
parsedChoices?.success ? parsedChoices.data : void 0
|
|
36821
|
+
parsedChoices?.success ? parsedChoices.data : void 0,
|
|
36822
|
+
parsedQuestionnaire?.success ? parsedQuestionnaire.data : void 0
|
|
36679
36823
|
)
|
|
36680
36824
|
);
|
|
36681
36825
|
} catch (err) {
|
|
@@ -38489,14 +38633,15 @@ function createCliRunner(adapter, opts = {}) {
|
|
|
38489
38633
|
throw new Error("prepared provider workspace does not match the task assignment");
|
|
38490
38634
|
}
|
|
38491
38635
|
const localMcpServers = askUserServer.register(runToken, {
|
|
38492
|
-
askUser: async (question, context, choices) => {
|
|
38636
|
+
askUser: async (question, context, choices, questionnaire) => {
|
|
38493
38637
|
pendingAsks++;
|
|
38494
38638
|
try {
|
|
38495
38639
|
const decision = await task.requestApproval(
|
|
38496
38640
|
"agent.question",
|
|
38497
38641
|
question.slice(0, 500),
|
|
38498
38642
|
(context || question).slice(0, MAX_APPROVAL_PAYLOAD),
|
|
38499
|
-
choices
|
|
38643
|
+
choices,
|
|
38644
|
+
questionnaire
|
|
38500
38645
|
);
|
|
38501
38646
|
return decision.guidance ?? (decision.approved ? "Approved. Proceed." : "No. Do not proceed.");
|
|
38502
38647
|
} finally {
|