@logic-joe/fleek 0.2.11 → 0.2.12

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.
Files changed (2) hide show
  1. package/dist/fleek.mjs +406 -64
  2. package/package.json +1 -1
package/dist/fleek.mjs CHANGED
@@ -1609,7 +1609,8 @@ var require_error_codes = __commonJS({
1609
1609
  // ONF-190: the browser proof failed because the request's refresh cookie names ANOTHER live web session of the same user (a
1610
1610
  // sign-in on another Fleek host replaced the shared cookie) - the web client renews its session at once (selected by the
1611
1611
  // HttpExceptionFilter from a server-owned request mark, never by a thrower)
1612
- "session_mismatch"
1612
+ "session_mismatch",
1613
+ "public_visibility"
1613
1614
  ];
1614
1615
  exports.WORKSPACE_APPS = ["chat", "projects", "documents", "whiteboards", "workflows"];
1615
1616
  exports.MAIL_DELIVERY_STATUSES = ["queued", "sending", "accepted", "ambiguous", "failed", "suppressed"];
@@ -4632,7 +4633,7 @@ var require_setup_session = __commonJS({
4632
4633
  exports.SETUP_SESSION_TTL_MINUTES = 30;
4633
4634
  exports.SETUP_SESSION_OPEN_MAX = 10;
4634
4635
  exports.SETUP_SESSION_CLAIM_LIMIT = 10;
4635
- exports.FLEEK_CLI_SETUP_VERSION_DEFAULT = "0.2.11";
4636
+ exports.FLEEK_CLI_SETUP_VERSION_DEFAULT = "0.2.12";
4636
4637
  exports.FLEEK_CLI_PACKAGE = "@logic-joe/fleek";
4637
4638
  exports.FLEEK_CANONICAL_SERVER = "https://api.onfleek.app";
4638
4639
  exports.SETUP_CLIENT_APPS = ["claude-code", "codex", "orca", "cursor", "other"];
@@ -5303,6 +5304,39 @@ var require_skill_limits = __commonJS({
5303
5304
  }
5304
5305
  });
5305
5306
 
5307
+ // ../types/dist/agent-platform/refusal-hints.js
5308
+ var require_refusal_hints = __commonJS({
5309
+ "../types/dist/agent-platform/refusal-hints.js"(exports) {
5310
+ "use strict";
5311
+ Object.defineProperty(exports, "__esModule", { value: true });
5312
+ exports.agentRefusalHint = agentRefusalHint;
5313
+ var hints = {
5314
+ public_visibility: {
5315
+ code: "HUMAN_REQUIRED",
5316
+ en: "Making a ticket public needs a person in the browser. Create it with internal visibility, then ask a person to publish it.",
5317
+ de: "Ein Ticket darf nur eine Person im Browser veröffentlichen. Erstelle es intern und bitte eine Person, es zu veröffentlichen."
5318
+ },
5319
+ release_name: {
5320
+ code: "INVALID_INPUT",
5321
+ en: "Use 1–80 plain-text characters without @, mentions, markup, links, encoded references or control characters.",
5322
+ de: "Verwende 1–80 Klartextzeichen ohne @, Erwähnungen, Markup, Links, kodierte Verweise oder Steuerzeichen."
5323
+ },
5324
+ setup_changing: {
5325
+ code: "CONFLICT",
5326
+ en: "The setup changed while it was being read, for example during an apply. Retry the setup read.",
5327
+ de: "Das Setup wurde während des Lesens geändert, etwa beim Anwenden. Lies das Setup erneut."
5328
+ }
5329
+ };
5330
+ function agentRefusalHint(code, details, locale2 = "en") {
5331
+ const reason = details?.reason;
5332
+ if (typeof reason !== "string" || !Object.hasOwn(hints, reason))
5333
+ return;
5334
+ const hint = hints[reason];
5335
+ return hint.code === code ? hint[locale2] : void 0;
5336
+ }
5337
+ }
5338
+ });
5339
+
5306
5340
  // ../types/dist/index.js
5307
5341
  var require_dist = __commonJS({
5308
5342
  "../types/dist/index.js"(exports) {
@@ -5341,6 +5375,7 @@ var require_dist = __commonJS({
5341
5375
  __exportStar(require_ticket_references(), exports);
5342
5376
  __exportStar(require_admin_todo(), exports);
5343
5377
  __exportStar(require_skill_limits(), exports);
5378
+ __exportStar(require_refusal_hints(), exports);
5344
5379
  }
5345
5380
  });
5346
5381
 
@@ -36040,6 +36075,305 @@ var require_document_diff = __commonJS({
36040
36075
  }
36041
36076
  });
36042
36077
 
36078
+ // ../validation/dist/agent-error-details.js
36079
+ var require_agent_error_details = __commonJS({
36080
+ "../validation/dist/agent-error-details.js"(exports) {
36081
+ "use strict";
36082
+ Object.defineProperty(exports, "__esModule", { value: true });
36083
+ exports.agentErrorDetails = agentErrorDetails2;
36084
+ var types_1 = require_dist();
36085
+ var string4 = (value) => typeof value === "string" && value.length > 0 && value.length <= 256;
36086
+ var integer = (value) => typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
36087
+ var list2 = (value) => Array.isArray(value) && value.length <= 128 && value.every(string4);
36088
+ var oneOf3 = (values) => (value) => typeof value === "string" && values.includes(value);
36089
+ var errors = (value) => Array.isArray(value) && value.length <= 64 && value.every((item2) => item2 && typeof item2 === "object" && !Array.isArray(item2) && Object.keys(item2).length === 2 && typeof item2.path === "string" && item2.path.length <= 256 && (item2.path === "" || item2.path.startsWith("/")) && typeof item2.code === "string" && /^[A-Z][A-Z0-9_]{0,63}$/.test(item2.code));
36090
+ var changeRequest = (value) => typeof value === "string" && value.length > 0 && value.length <= 500;
36091
+ var typeKeyBytes = (value) => typeof value === "string" && value.length > 0 && (0, types_1.issueTypeJsonBytes)(value) <= types_1.ISSUE_TYPE_LIMITS.entryKeyBytes;
36092
+ var typeKeyList = (value) => Array.isArray(value) && value.length <= types_1.ISSUE_TYPE_LIMITS.entries && value.every(typeKeyBytes);
36093
+ var uuid = (value) => typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(value);
36094
+ var personRef = (value) => value === null || typeof value === "string" && value.length > 0 && value.length <= 64;
36095
+ var transitionKeys = (value) => Array.isArray(value) && value.length <= 32 && value.every((item2) => typeof item2 === "string" && item2.length > 0 && item2.length <= 64 && /^[A-Za-z0-9_.:-]+$/.test(item2) && ([...types_1.TRANSITION_CONDITIONS, ...types_1.TRANSITION_REQUIRED_FIELDS].includes(item2) || /^[a-z0-9_.:-]+$/.test(item2)));
36096
+ var bindingField = (value) => typeof value === "string" && value.length <= 130 && (/^state:(?:[a-z][a-z0-9_]{0,31}|\+[0-9a-f-]{36})\.(?:role|gate|omitted)$/.test(value) || /^rule:\+[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(value) || /^rule:(?:\*|[a-z][a-z0-9_]{0,31})>[a-z][a-z0-9_]{0,31}$/.test(value) || ["phases", "roles.defaultRole", "routeOptions", "clarification.maxQuestions", "clarification.maxQuestionsPerRound", "clarification.maxRounds", "clarification.answerWithinHours", "clarification.handoffRouteKey", "clarification.handoffUserId"].includes(value));
36097
+ var schema = {
36098
+ TICKET_TEXT_LIMIT: {},
36099
+ TICKET_TEXT_FORMAT: {},
36100
+ TICKET_TEXT_LOSSY_REPLACEMENT: {},
36101
+ ACCESS_DENIED: { reason: oneOf3(["approval_denied", "field_right", "variant_admin"]), field: bindingField, changeRequest },
36102
+ // ENGINE-AUTHORITY: engine setup refusals (`workflows.engine.*`) - closed lists only
36103
+ CONFLICT: {
36104
+ state: oneOf3(types_1.WORKFLOW_ENGINE_STATES),
36105
+ stoppedReason: oneOf3(types_1.WORKFLOW_ENGINE_STOPPED_REASONS),
36106
+ reason: oneOf3(["setup_changing", "releases_disabled", "release_closed", "name_taken", "active_limit", "too_many_open", "engine_authority_unavailable", "engine_not_admitted", "hidden_bindings", ...types_1.WORK_REQUEST_CONFLICT_REASONS, ...types_1.TRIAGE_CONFLICT_REASONS, ...types_1.KIT_CONFLICT_REASONS, ...types_1.STANDING_CONFLICT_REASONS, ...types_1.SETUP_CONFLICT_REASONS, ...types_1.SETUP_PROPOSAL_CONFLICT_REASONS, ...types_1.KNOWLEDGE_SETUP_REASONS, ...types_1.PROJECT_INIT_CONFLICT_REASONS, ...types_1.CUSTOMER_PROPOSAL_CONFLICT_REASONS, ...types_1.KNOWLEDGE_INGEST_REASONS, ...types_1.ACCESS_REQUEST_CONFLICT_REASONS, ...types_1.SERVICE_ACCOUNT_CONFLICT_REASONS, ...types_1.SETUP_SESSION_CONFLICT_REASONS]),
36107
+ index: integer,
36108
+ statementId: uuid,
36109
+ // INGEST-RELEASE-UX: the draft parent page a release cannot publish along (`parent_unpublished`; only a page the caller can view)
36110
+ parentId: uuid,
36111
+ // PINIT-FIX-2: the application slot page a PROJECT-INIT adoption refused (closed list, no id)
36112
+ slot: oneOf3(types_1.KNOWLEDGE_APPLICATION_SLOTS),
36113
+ statementIds: (value) => Array.isArray(value) && value.length <= 200 && value.every(uuid),
36114
+ fields: (value) => Array.isArray(value) && value.length <= 4 && value.every(oneOf3(["title", "summary", "diagram", "page", "parent"]))
36115
+ },
36116
+ // PRIVACY-WORKCTX: additive `holderRef` (person ref of the holder, null without a handle key / release owner)
36117
+ ALREADY_CLAIMED: { holderLabel: string4, expiresAt: string4, holderRef: personRef },
36118
+ CLAIMED_BY_OTHER: { holderLabel: string4, expiresAt: string4, holderRef: personRef },
36119
+ CLAIM_REQUIRED: { issueIds: list2 },
36120
+ RENEW_LIMIT: { hardExpiresAt: string4 },
36121
+ NOT_READY: { readySelector: string4 },
36122
+ REVISION_CONFLICT: { currentRevision: integer },
36123
+ STATE_CONFLICT: { currentStateVersion: integer },
36124
+ TYPED_COMMENT_IMMUTABLE: { kind: string4 },
36125
+ // PRIVACY-WORKCTX: `assigneeId`, `userIds`, `userId` = wire names of declared person inputs (uniform refusal; never a value);
36126
+ // P2: the workflow person inputs `botUserId`, `designerUserIds`, `ownerUserId`, `user` (spec / edit `assign.user`)
36127
+ INVALID_INPUT: {
36128
+ field: oneOf3([
36129
+ "releaseId",
36130
+ "projectReleaseId",
36131
+ "moveOpenTo",
36132
+ "targetDate",
36133
+ "addressees",
36134
+ "options",
36135
+ "parent",
36136
+ "artifacts",
36137
+ "toUserId",
36138
+ "optionId",
36139
+ "assigneeId",
36140
+ "userIds",
36141
+ "userId",
36142
+ "botUserId",
36143
+ "designerUserIds",
36144
+ "ownerUserId",
36145
+ "user",
36146
+ "data",
36147
+ "inputs",
36148
+ "value",
36149
+ // A2A-DELIVERY AD-1 input fields
36150
+ "after",
36151
+ "agent",
36152
+ "delegateAgent",
36153
+ "neededBy",
36154
+ "pickupMinutes",
36155
+ "question",
36156
+ "teamId",
36157
+ "toAgent",
36158
+ // ONF-142 (Codex B1): a referenced create-dialog image that cannot be bound (foreign, expired, unknown) refuses the create
36159
+ "attachmentIds",
36160
+ // A2A-DELIVERY AD-1b input fields (person addresses keep the uniform PRIVACY refusal shape)
36161
+ "person",
36162
+ "forPerson",
36163
+ "requester",
36164
+ "for",
36165
+ "title",
36166
+ "description",
36167
+ "display",
36168
+ "scope",
36169
+ "kinds",
36170
+ "requestId",
36171
+ // AGD TEAM-RULES-a1: a transition plan over its bounds (TRANSITION_PLAN_LIMITS); a1.2 team process documents (N1 bounds,
36172
+ // shape, states of the team, live deciders)
36173
+ "issueIds",
36174
+ "body",
36175
+ "deciderUserIds",
36176
+ "deciders",
36177
+ "memberRoles",
36178
+ "phases",
36179
+ "rules",
36180
+ "states",
36181
+ // TEAMS-PROJECTS TP-4: Team (user group) create / rename
36182
+ "handle",
36183
+ // AGD CLARIFY-a: handoff (`assignTo` staff only, `reason` derived server-side) and the policy's escalation person
36184
+ "assignTo",
36185
+ "reason",
36186
+ "handoffUserId",
36187
+ // TES-219: a page's explicit space differs from its parent's space (documents.create / knowledge.createPage)
36188
+ "spaceId",
36189
+ // AGD GUIDE-a1: guidance version entries (bounded page list) and pin targets; a2: a role the server did not derive
36190
+ "documentIds",
36191
+ "versionId",
36192
+ "role",
36193
+ // AGD WORK-FOLDER-a: an assessment item (with `index`)
36194
+ "items",
36195
+ "subjectIssueId",
36196
+ "targetTeamId",
36197
+ "targetProjectId",
36198
+ // AGD TRIAGE-a: the route field of an issue write, classification inputs, route option documents
36199
+ "statePools",
36200
+ "deciderPoolIds",
36201
+ "fieldKeys",
36202
+ "choices",
36203
+ "clarification",
36204
+ "stateMap",
36205
+ "deliveryRoute",
36206
+ "duplicates",
36207
+ "type",
36208
+ "route",
36209
+ "priority",
36210
+ "readinessAssessmentId",
36211
+ "options",
36212
+ // AGD QUICKVIEW-a: "Meine Arbeit" paging / navigation (sealed cursor, kind filter, page size) and the guest preview flag
36213
+ "cursor",
36214
+ "kind",
36215
+ "limit",
36216
+ "view",
36217
+ "query",
36218
+ // SKILL-REQ bounded fields: names of inputs only, never stored text.
36219
+ "key",
36220
+ "name",
36221
+ "url",
36222
+ "label",
36223
+ "sourceUrl",
36224
+ "packageVersion",
36225
+ "purpose",
36226
+ "installHints",
36227
+ "item",
36228
+ // KITS-a admin inputs (SETTINGS-AGENTWORK-b): pin targets, host address
36229
+ "teamIds",
36230
+ "origin",
36231
+ "holder",
36232
+ // AGD WORK-FOLDER-b: the gate role of a checklist read / readiness write
36233
+ "gateRole",
36234
+ // FOCUS-MODE FM-1: a malformed UI focus parameter (`@UiFocus()`; the grammar is the only reason)
36235
+ "focus",
36236
+ // AGD CLIENT-AI-a: a field outside the guest toolset's list (closed: the guest tools' own input fields)
36237
+ ...types_1.CLIENT_AI_REFUSED_FIELDS,
36238
+ // AGENT-SCOPE (AS-1): a refused installation scope / scoped area list (`scope`, `clientGroupId`, `teamIds`, `spaceIds`, `allowedAreas`)
36239
+ ...types_1.AGENT_SCOPE_INVALID_FIELDS,
36240
+ // AGD AGENT-RELEASE-b RB-3: a standing order's target (installation not scoped to exactly the group, group not exclusive)
36241
+ ...types_1.STANDING_INVALID_FIELDS,
36242
+ ...types_1.SETUP_INVALID_FIELDS,
36243
+ ...types_1.SETUP_PROPOSAL_INVALID_FIELDS,
36244
+ // AGD SETUP-KNOW: knowledge setup writer inputs
36245
+ "area",
36246
+ "applicationId",
36247
+ "slot",
36248
+ "documentId",
36249
+ "pathHint",
36250
+ "expectedRevision",
36251
+ "condition",
36252
+ "derivedFromVersionId",
36253
+ "editSpaceIds",
36254
+ // AGD SETUP-KNOW SK-5b: customer proposal inputs
36255
+ ...types_1.CUSTOMER_PROPOSAL_INVALID_FIELDS,
36256
+ // AGD PROJECT-INIT: the summary (with `path`), selection, customer, project key, run epoch
36257
+ ...types_1.PROJECT_INIT_INVALID_FIELDS,
36258
+ // PROJ-REPO-LINK: the repository reference (never echoes the value)
36259
+ "repository",
36260
+ // AGD-62 LJK-1: the typed result's acceptance verdict (work.complete; explicit, not only through the guest refusal list)
36261
+ "acceptance",
36262
+ // KNOW-INGEST: run / submit / review inputs (names only)
36263
+ ...types_1.KNOWLEDGE_INGEST_INVALID_FIELDS,
36264
+ // AGENT-ATTACH: the file of `issues.attachFile` (names only, never the value)
36265
+ "fileName",
36266
+ "content",
36267
+ "mimeType",
36268
+ "commentId",
36269
+ // AGENT-ATTACH-2: the presigned upload of `issues.attachFileBegin` / `issues.attachFileComplete`
36270
+ "size",
36271
+ "uploadId",
36272
+ // ACCESS-REQUESTS: request / decision / self request inputs (names only)
36273
+ ...types_1.ACCESS_REQUEST_INVALID_FIELDS
36274
+ ]),
36275
+ index: integer,
36276
+ path: (value) => (0, types_1.isProjectInitPath)(value) || (0, types_1.isKnowledgeSubmitPath)(value),
36277
+ // WF-TF-2 `not_target_project`; WORK-FOLDER-b `human_only` = an agent assessment named an item only a human sets
36278
+ reason: oneOf3(["release_name", ...types_1.WORK_REQUEST_INVALID_REASONS, "incompatible_work_filters", "not_target_project", "human_only", "system_item", ...types_1.SKILL_INVALID_REASONS, ...types_1.KIT_INVALID_INPUT_REASONS, ...types_1.SETUP_INVALID_REASONS, ...types_1.SETUP_PROPOSAL_INVALID_REASONS, ...types_1.KNOWLEDGE_SETUP_REASONS, ...types_1.PROJECT_INIT_INVALID_REASONS, ...types_1.KNOWLEDGE_INGEST_INVALID_REASONS]),
36279
+ maxBytes: integer,
36280
+ maxItems: integer,
36281
+ messageKey: oneOf3(["agentWorkSkills.errors.fieldLimit", "agentWorkSkills.errors.countLimit"]),
36282
+ // CFG-B4 (M2): a change draft's browser-only op names the server-built absolute settings link (`browserLink`, ?section=)
36283
+ url: (value) => typeof value === "string" && value.length <= 512 && /^https?:\/\/[^\s<>"']+\?section=[a-z-]+$/.test(value)
36284
+ },
36285
+ HUMAN_REQUIRED: { reason: oneOf3(types_1.HUMAN_REQUIRED_REASONS) },
36286
+ // W3 SETTINGS-AGENTWORK-b: closed validator reason + closed content path (never a caller key or text)
36287
+ KIT_INVALID: { reason: oneOf3(types_1.KIT_ISSUE_REASONS), path: types_1.isKitIssuePath },
36288
+ // AGD CLARIFY-a: a refused clarification question tells the agent protocol to hand off (`fleek_request_human`)
36289
+ QUOTA_EXCEEDED: { dimension: string4, limit: integer, retryAfterSeconds: integer, hint: oneOf3(["request_human"]) },
36290
+ // A2A-DELIVERY: never an identity
36291
+ ADDRESSED_TO_OTHER_AGENT: { since: string4 },
36292
+ ADDRESSED_TO_PERSON: { since: string4 },
36293
+ WORK_ITEM_TAKEN: { takenByRef: personRef },
36294
+ WORK_REQUEST_STATE: { state: oneOf3(types_1.WORK_REQUEST_DISPLAY) },
36295
+ APP_DISABLED: { app: oneOf3(types_1.WORKSPACE_APPS) },
36296
+ APPROVER_LACKS_RIGHTS: { missing: list2 },
36297
+ RUN_EXISTS: { runId: string4 },
36298
+ OUTPUTS_INVALID: { errors },
36299
+ SPEC_INVALID: { errors },
36300
+ DRAFT_CONFLICT: { currentDraftRevision: integer },
36301
+ ROLE_UNRESOLVED: { roleKey: string4 },
36302
+ ROLE_PRINCIPAL_NOT_ELIGIBLE: { userId: string4 },
36303
+ ITEM_LIMIT: { limit: integer },
36304
+ RESULT_TOO_LARGE: { limit: integer },
36305
+ APPROVAL_MODE_NOT_ALLOWED: { mode: oneOf3([...types_1.WORKFLOW_APPROVAL_MODES, "inherit"]), workspaceMode: oneOf3(types_1.WORKFLOW_APPROVAL_MODES) },
36306
+ BATCH_TOO_LARGE: { maxItems: integer, maxBytes: integer },
36307
+ WORKFLOW_NOT_STARTABLE: { reason: oneOf3(types_1.WORKFLOW_NOT_STARTABLE_REASONS) },
36308
+ WORKFLOW_TASK_RECONCILING: { retryAfterSeconds: integer },
36309
+ WORKFLOW_TASK_RESULT_REQUIRED: { missing: list2 },
36310
+ ISSUE_TYPE_NOT_ALLOWED: { type: typeKeyBytes, teamId: uuid, allowed: typeKeyList },
36311
+ ISSUE_TYPE_CATALOG_MISSING: { reason: oneOf3(types_1.ISSUE_TYPE_CATALOG_MISSING_REASONS) },
36312
+ ISSUE_TYPE_ARCHIVED: { typeId: uuid },
36313
+ ISSUE_TYPE_IS_DEFAULT: { setCount: integer },
36314
+ ISSUE_TYPE_SET_IN_USE: { teamCount: integer },
36315
+ ISSUE_TYPE_SET_INVALID: { reason: oneOf3(types_1.ISSUE_TYPE_SET_INVALID_REASONS) },
36316
+ ISSUE_TYPE_LIMIT: { limit: integer },
36317
+ // TCONN-1: allowlisted reasons / capability column names only (never provider text)
36318
+ TARGET_LOCATION_UNAVAILABLE: { reason: oneOf3(types_1.TARGET_ERROR_REASONS) },
36319
+ TARGET_CONNECTION_REAUTH: { reason: oneOf3(types_1.TARGET_ERROR_REASONS) },
36320
+ TARGET_PATH_INVALID: { reason: oneOf3(types_1.TARGET_ERROR_REASONS) },
36321
+ TARGET_FILE_TOO_LARGE: { maxBytes: integer },
36322
+ TARGET_CAPABILITY_MISSING: { reason: oneOf3(types_1.TARGET_ERROR_REASONS), capability: oneOf3(types_1.TARGET_CAPABILITIES) },
36323
+ TARGET_ACCOUNT_MISMATCH: { reason: oneOf3(types_1.TARGET_ERROR_REASONS) },
36324
+ // AGD TEAM-RULES-a1: ids / closed keys only (`missing` = condition / field keys, never content; restricted actors get none)
36325
+ // AGD-51: `openPoints` = the same closed key shape (condition / checklist keys; only for a proven unrestricted human)
36326
+ TRANSITION_DENIED: { reason: oneOf3(types_1.TRANSITION_DENIED_REASONS), toStateId: uuid, collectingStateId: uuid, missing: transitionKeys, openPoints: transitionKeys },
36327
+ TEAM_PROCESS_INVALID: { reason: oneOf3(types_1.TEAM_PROCESS_INVALID_REASONS) },
36328
+ FIELD_LOCKED: { field: oneOf3([...types_1.TEAM_PROCESS_LOCKED_FIELDS, "projectReleaseId"]) },
36329
+ // AGD COST-LIMITS-a: the unit only (never an amount)
36330
+ COST_LIMIT_REACHED: { unit: oneOf3(["tokens", "eur"]) },
36331
+ // AGD TRIAGE-a: the project only
36332
+ ROUTE_NOT_ALLOWED: { teamId: uuid },
36333
+ // AGD KNOW-MAINT-a: a count only (never the ids of changes the reviewer may not review)
36334
+ KNOWLEDGE_REVIEW_FORBIDDEN: { count: integer },
36335
+ // AGD KNOW-MAINT-b: bounds, section ids of the proposal itself and counts only (never page ids or text)
36336
+ KNOWLEDGE_RULE_SUBTREE_TOO_LARGE: { maxPages: integer },
36337
+ KNOWLEDGE_REWRITE_REQUIRED: { sectionIds: (value) => Array.isArray(value) && value.length <= 20 && value.every((item2) => typeof item2 === "string" && /^(?:block:\d{1,8}|end)$/.test(item2)) },
36338
+ KNOWLEDGE_REVIEW_PENDING: { count: integer },
36339
+ // AGD GUIDE-a: closed reasons / ids only (never a page name or text)
36340
+ GUIDANCE_INVALID: { reason: oneOf3(types_1.GUIDANCE_INVALID_REASONS), documentId: uuid },
36341
+ // AGD PROC-TEMPLATES-a: closed reason, a document member or input field (never a value), its position
36342
+ PROCESS_TEMPLATE_INVALID: { reason: oneOf3(types_1.PROCESS_TEMPLATE_INVALID_REASONS), field: (value) => bindingField(value) || oneOf3([...types_1.PROCESS_TEMPLATE_DOCUMENT_FIELDS, ...types_1.PROCESS_TEMPLATE_INPUT_FIELDS, ...types_1.TRANSITION_CONDITIONS, ...types_1.TRANSITION_REQUIRED_FIELDS])(value), index: integer },
36343
+ RULE_PAGE_BUSY: { retryAfterSeconds: integer },
36344
+ GUIDANCE_REQUIRED: { tool: oneOf3(["fleek_get_guidance"]) },
36345
+ GUIDANCE_STALE: { tool: oneOf3(["fleek_get_guidance"]) },
36346
+ // AGD WORK-FOLDER-a: the bound checklist version (null = none bound); WORK-FOLDER-b: the gate role of the fenced key
36347
+ CHECKLIST_STALE: { boundVersionId: (value) => value === null || uuid(value), gateRole: oneOf3(types_1.GUIDANCE_CHECKLIST_GATE_ROLES) },
36348
+ // AGD WORK-FOLDER-b: the closed reason only (never the object a native URL names)
36349
+ ISSUE_LINK_INVALID: { reason: oneOf3(types_1.ISSUE_LINK_INVALID_REASONS) },
36350
+ // AGENT-ATTACH: the decoded size limit of an inline agent file (the transport's own 413 carries no details)
36351
+ CONTENT_TOO_LARGE: { maxBytes: integer },
36352
+ // AGENT-ATTACH-2: the closed reason of a refused upload completion (never a storage detail)
36353
+ ATTACHMENT_UPLOAD_INVALID: { reason: oneOf3(types_1.ATTACHMENT_UPLOAD_INVALID_REASONS) }
36354
+ };
36355
+ function agentErrorDetails2(code, value) {
36356
+ if (!value || typeof value !== "object" || Array.isArray(value) || !Object.hasOwn(schema, code))
36357
+ return;
36358
+ const validators = schema[code];
36359
+ const result = {};
36360
+ for (const [name, validate] of Object.entries(validators)) {
36361
+ const field = value[name];
36362
+ if (validate(field))
36363
+ result[name] = JSON.parse(JSON.stringify(field));
36364
+ }
36365
+ let bytes = 0;
36366
+ for (const char of JSON.stringify(result)) {
36367
+ const point = char.codePointAt(0);
36368
+ bytes += point <= 127 ? 1 : point <= 2047 ? 2 : point <= 65535 ? 3 : 4;
36369
+ }
36370
+ if (!Object.keys(result).length || bytes > 4096)
36371
+ return;
36372
+ return result;
36373
+ }
36374
+ }
36375
+ });
36376
+
36043
36377
  // ../validation/dist/index.js
36044
36378
  var require_dist2 = __commonJS({
36045
36379
  "../validation/dist/index.js"(exports) {
@@ -36090,11 +36424,12 @@ var require_dist2 = __commonJS({
36090
36424
  __exportStar(require_doc_statement(), exports);
36091
36425
  __exportStar(require_document_diff(), exports);
36092
36426
  __exportStar(require_zod_compat(), exports);
36427
+ __exportStar(require_agent_error_details(), exports);
36093
36428
  }
36094
36429
  });
36095
36430
 
36096
36431
  // src/cli.ts
36097
- var import_types10 = __toESM(require_dist(), 1);
36432
+ var import_types11 = __toESM(require_dist(), 1);
36098
36433
  import { spawn as spawn9 } from "node:child_process";
36099
36434
  import { createHash as createHash9, randomBytes as randomBytes12 } from "node:crypto";
36100
36435
  import { rm as rm13 } from "node:fs/promises";
@@ -39766,6 +40101,8 @@ async function serveMcp(client, options) {
39766
40101
  }
39767
40102
 
39768
40103
  // src/mcp-proxy.ts
40104
+ var import_types3 = __toESM(require_dist(), 1);
40105
+ var import_validation = __toESM(require_dist2(), 1);
39769
40106
  var PROXY_LEGACY_VERSIONS = ["2025-11-25", "2025-06-18"];
39770
40107
  var DEFAULT_VERSION = PROXY_LEGACY_VERSIONS[0];
39771
40108
  var LINE_LIMIT = 1024 * 1024;
@@ -39908,12 +40245,17 @@ async function runProxy(options) {
39908
40245
  }
39909
40246
  if (response.status >= 400) {
39910
40247
  let code = response.status === 403 ? "ACCESS_DENIED" : response.status === 413 ? "CONTENT_TOO_LARGE" : "INVALID_INPUT";
40248
+ let details;
39911
40249
  try {
39912
40250
  const parsed = JSON.parse(raw);
39913
- if (object2(parsed) && typeof parsed.error === "string" && CODE.test(parsed.error)) code = parsed.error;
40251
+ if (object2(parsed)) {
40252
+ if (typeof parsed.error === "string" && CODE.test(parsed.error)) code = parsed.error;
40253
+ if (typeof parsed.code === "string" && Object.hasOwn(import_types3.AGENT_ERROR_CODES, parsed.code) && import_types3.AGENT_ERROR_CODES[parsed.code].mcpLegacy === parsed.error) code = parsed.code;
40254
+ if (Object.hasOwn(import_types3.AGENT_ERROR_CODES, code)) details = (0, import_validation.agentErrorDetails)(code, parsed.details);
40255
+ }
39914
40256
  } catch {
39915
40257
  }
39916
- throw new Refused(proxyError(id, code, code === "ACCESS_DENIED" ? "Fleek refused the request (access denied)." : `Fleek refused the request (${code}).`));
40258
+ throw new Refused(proxyError(id, code, code === "ACCESS_DENIED" ? "Fleek refused the request (access denied)." : `Fleek refused the request (${code}).`, details ? { details } : {}));
39917
40259
  }
39918
40260
  throw new TransientError(response.status);
39919
40261
  }
@@ -48099,7 +48441,7 @@ function kitContentHash(content3) {
48099
48441
  }
48100
48442
 
48101
48443
  // ../kit-format/dist/payload.js
48102
- var import_types3 = __toESM(require_dist(), 1);
48444
+ var import_types4 = __toESM(require_dist(), 1);
48103
48445
  var KIT_VERSION_PURPOSE = "fleek-kit/1";
48104
48446
  var KIT_STATUS_PURPOSE = "fleek-kit-status/1";
48105
48447
  var KIT_STATUS_STATES = ["current", "superseded", "revoked", "unsigned", "not_entitled"];
@@ -48171,7 +48513,7 @@ function parseVersionAttestationPayload(value) {
48171
48513
  workspaceId: matching(p.workspaceId, UUID, "$.workspaceId"),
48172
48514
  kitKey: kitKeyOf(p.kitKey, "$.kitKey"),
48173
48515
  kind: oneOf(p.kind, KIT_KINDS, "$.kind"),
48174
- role: oneOf(p.role, import_types3.PROJECT_MEMBER_ROLES, "$.role"),
48516
+ role: oneOf(p.role, import_types4.PROJECT_MEMBER_ROLES, "$.role"),
48175
48517
  audienceClass,
48176
48518
  clientGroupId,
48177
48519
  version: version(p.version, "$.version"),
@@ -48202,7 +48544,7 @@ function parseStatusPayload(value) {
48202
48544
  return {
48203
48545
  kitKey: kitKeyOf(e.kitKey, `${path}.kitKey`),
48204
48546
  kind: oneOf(e.kind, KIT_KINDS, `${path}.kind`),
48205
- role: oneOf(e.role, import_types3.PROJECT_MEMBER_ROLES, `${path}.role`),
48547
+ role: oneOf(e.role, import_types4.PROJECT_MEMBER_ROLES, `${path}.role`),
48206
48548
  pinnedVersion: version(e.pinnedVersion, `${path}.pinnedVersion`)
48207
48549
  };
48208
48550
  });
@@ -48900,7 +49242,7 @@ function projectFactsForStack(products, catalog = LJ_TECHNOLOGY_CATALOG) {
48900
49242
  }
48901
49243
 
48902
49244
  // src/kit-store.ts
48903
- var import_types4 = __toESM(require_dist(), 1);
49245
+ var import_types5 = __toESM(require_dist(), 1);
48904
49246
  var STATE_VERSION = 1;
48905
49247
  var GEN = /^gen-[0-9a-f]{24}$/;
48906
49248
  var corrupt2 = (path) => new CliError("errors.kitStateCorrupt", EXIT.failed, { path }, "KIT_STATE_CORRUPT");
@@ -48913,7 +49255,7 @@ function validState(value, profileKey2, projectId) {
48913
49255
  if (typeof s.workspaceId !== "string" || typeof s.issuer !== "string" || !Array.isArray(s.kits) || s.kits.length > 64) return false;
48914
49256
  if (!s.targets || typeof s.targets !== "object" || !s.checkouts || typeof s.checkouts !== "object" || !Array.isArray(s.mcp) || typeof s.checkoutMode !== "boolean") return false;
48915
49257
  for (const kit2 of s.kits) {
48916
- if (!kit2 || !isKitKey(kit2.kitKey) || !KIT_KINDS.includes(kit2.kind) || !import_types4.PROJECT_MEMBER_ROLES.includes(kit2.role) || !KIT_PLACEMENTS.includes(kit2.placement) || !Number.isSafeInteger(kit2.version) || !Number.isSafeInteger(kit2.minVersion) || typeof kit2.contentHash !== "string" || typeof kit2.versionId !== "string") return false;
49258
+ if (!kit2 || !isKitKey(kit2.kitKey) || !KIT_KINDS.includes(kit2.kind) || !import_types5.PROJECT_MEMBER_ROLES.includes(kit2.role) || !KIT_PLACEMENTS.includes(kit2.placement) || !Number.isSafeInteger(kit2.version) || !Number.isSafeInteger(kit2.minVersion) || typeof kit2.contentHash !== "string" || typeof kit2.versionId !== "string") return false;
48917
49259
  }
48918
49260
  for (const target of Object.keys(s.targets)) if (!KIT_TARGETS.includes(target)) return false;
48919
49261
  if (s.undecided !== void 0 && (!s.undecided || typeof s.undecided !== "object" || Array.isArray(s.undecided))) return false;
@@ -49678,7 +50020,7 @@ async function orcaPick(deps, values, start2) {
49678
50020
  }
49679
50021
 
49680
50022
  // src/start.ts
49681
- var import_types5 = __toESM(require_dist(), 1);
50023
+ var import_types6 = __toESM(require_dist(), 1);
49682
50024
  import { basename as basename2, dirname as dirname6, isAbsolute as isAbsolute6 } from "node:path";
49683
50025
 
49684
50026
  // src/mutation.ts
@@ -49763,7 +50105,7 @@ async function liveFacts(client, task) {
49763
50105
  let step = null;
49764
50106
  if (stateId && tools.has("fleek_list_workflow_states")) {
49765
50107
  const state = (await pages(client, "fleek_list_workflow_states", { teamId: task.projectId }, 200)).find((row) => string3(row.id).toLowerCase() === stateId);
49766
- step = state && (0, import_types5.isOpenInStep)(state.role) ? state.role : null;
50108
+ step = state && (0, import_types6.isOpenInStep)(state.role) ? state.role : null;
49767
50109
  }
49768
50110
  return { step, claims, providers };
49769
50111
  }
@@ -49883,8 +50225,8 @@ function receiptOf(run2) {
49883
50225
  };
49884
50226
  }
49885
50227
  function promptOf(profile, task, step, role, lang, claim) {
49886
- const text6 = (0, import_types5.openInStartText)({ workspace: profile.workspace.slug, ticket: task.key, step, role, locale: lang, claim });
49887
- return text6 && text6.length <= import_types5.OPEN_IN_TEXT_MAX ? text6 : null;
50228
+ const text6 = (0, import_types6.openInStartText)({ workspace: profile.workspace.slug, ticket: task.key, step, role, locale: lang, claim });
50229
+ return text6 && text6.length <= import_types6.OPEN_IN_TEXT_MAX ? text6 : null;
49888
50230
  }
49889
50231
  async function runStart(deps, input) {
49890
50232
  const { profile, task, root, program } = input;
@@ -49949,7 +50291,7 @@ async function runStart(deps, input) {
49949
50291
  key: task.key,
49950
50292
  title: neutralizeLine(task.title).slice(0, 120),
49951
50293
  agent: agent === "codex" ? "Codex" : agent === "claude" ? "Claude" : neutralizeLine(agent).slice(0, 32),
49952
- task: (0, import_types5.openInTask)(step, role, cliLang)
50294
+ task: (0, import_types6.openInTask)(step, role, cliLang)
49953
50295
  };
49954
50296
  const state = delivered ? { branch: neutralizeLine(delivered.branch), sha: delivered.sha.slice(0, 10), date: delivered.date } : null;
49955
50297
  const question = [
@@ -53426,12 +53768,12 @@ async function validProgram(program, configDir) {
53426
53768
  }
53427
53769
 
53428
53770
  // src/link.ts
53429
- var import_types6 = __toESM(require_dist(), 1);
53771
+ var import_types7 = __toESM(require_dist(), 1);
53430
53772
  import { stat as stat13 } from "node:fs/promises";
53431
53773
  import { dirname as dirname17 } from "node:path";
53432
- var LINK_SCHEME = import_types6.OPEN_IN_LINK_SCHEME;
53774
+ var LINK_SCHEME = import_types7.OPEN_IN_LINK_SCHEME;
53433
53775
  function parseFleekLink(input) {
53434
- const link3 = (0, import_types6.parseOpenInLink)(input);
53776
+ const link3 = (0, import_types7.parseOpenInLink)(input);
53435
53777
  return link3 ? { action: "orca-open", ...link3 } : null;
53436
53778
  }
53437
53779
  var refused = (key, code, params = {}) => new CliError(key, EXIT.failed, params, code);
@@ -53964,7 +54306,7 @@ import { spawn as spawn7 } from "node:child_process";
53964
54306
  import { randomBytes as randomBytes10 } from "node:crypto";
53965
54307
  import { readFile as readFile21, realpath as realpath16 } from "node:fs/promises";
53966
54308
  import { isAbsolute as isAbsolute10, join as join28, resolve as resolve6, sep as sep8 } from "node:path";
53967
- var import_types7 = __toESM(require_dist(), 1);
54309
+ var import_types8 = __toESM(require_dist(), 1);
53968
54310
 
53969
54311
  // src/kit-keys.ts
53970
54312
  var KIT_KEYS = Object.freeze({
@@ -54042,7 +54384,7 @@ import { join as join26, resolve as resolve5 } from "node:path";
54042
54384
 
54043
54385
  // src/init-scan.ts
54044
54386
  import { spawn as spawn6 } from "node:child_process";
54045
- var import_validation = __toESM(require_dist2(), 1);
54387
+ var import_validation2 = __toESM(require_dist2(), 1);
54046
54388
  import { createHash as createHash7 } from "node:crypto";
54047
54389
  import { constants as fsConstants4 } from "node:fs";
54048
54390
  import { lstat as lstat12, mkdir as mkdir8, open as open5, realpath as realpath15, writeFile as writeFile4 } from "node:fs/promises";
@@ -54137,7 +54479,7 @@ async function readJson(root, path) {
54137
54479
  }
54138
54480
  async function readSmall2(root, path, max) {
54139
54481
  try {
54140
- if (!(0, import_validation.evidencePathAllowed)(path)) return null;
54482
+ if (!(0, import_validation2.evidencePathAllowed)(path)) return null;
54141
54483
  const realRoot = await realpath15(root), source = join25(root, path);
54142
54484
  if (await realpath15(source) !== join25(realRoot, ...path.split("/"))) return null;
54143
54485
  const seen = await lstat12(source);
@@ -54292,7 +54634,7 @@ async function scanFacts(checkout, app) {
54292
54634
  const stack = [];
54293
54635
  const add = (category, product, major, evidence) => {
54294
54636
  if (stack.some((entry) => entry.category === category && entry.product === product) || stack.length >= 60) return;
54295
- stack.push({ category, product, major, evidence: (0, import_validation.evidencePathAllowed)(evidence) ? [evidence] : [] });
54637
+ stack.push({ category, product, major, evidence: (0, import_validation2.evidencePathAllowed)(evidence) ? [evidence] : [] });
54296
54638
  };
54297
54639
  const manifestPath = `${prefix}package.json`;
54298
54640
  const manifest = own4.includes(manifestPath) ? await readJson(checkout.root, manifestPath) : null;
@@ -54339,9 +54681,9 @@ async function scanFacts(checkout, app) {
54339
54681
  }
54340
54682
  }
54341
54683
  const stories = own4.filter((file) => /\.stories\.(?:tsx?|jsx?|mdx|vue|svelte)$/.test(file));
54342
- const configPath = own4.find((file) => /(?:^|\/)\.storybook\/main\.(?:[cm]?[jt]s)$/.test(file) && (0, import_validation.evidencePathAllowed)(file)) ?? null;
54343
- const patternConfig = own4.find((file) => /(?:^|\/)patternlab-config\.json$/.test(file) && (0, import_validation.evidencePathAllowed)(file)) ?? null;
54344
- const patternFiles = own4.filter((file) => /(?:^|\/)source\/_patterns\/.*\.(?:mustache|twig|hbs|handlebars|html|njk)$/.test(file) && (0, import_validation.evidencePathAllowed)(file));
54684
+ const configPath = own4.find((file) => /(?:^|\/)\.storybook\/main\.(?:[cm]?[jt]s)$/.test(file) && (0, import_validation2.evidencePathAllowed)(file)) ?? null;
54685
+ const patternConfig = own4.find((file) => /(?:^|\/)patternlab-config\.json$/.test(file) && (0, import_validation2.evidencePathAllowed)(file)) ?? null;
54686
+ const patternFiles = own4.filter((file) => /(?:^|\/)source\/_patterns\/.*\.(?:mustache|twig|hbs|handlebars|html|njk)$/.test(file) && (0, import_validation2.evidencePathAllowed)(file));
54345
54687
  const hasPatternLabDependency = manifest !== null && Object.keys(dependencies(manifest)).some((name) => name.startsWith("@pattern-lab/"));
54346
54688
  const patternLab = patternConfig !== null || patternFiles.length > 0 || hasPatternLabDependency;
54347
54689
  const atomicLevel = (file) => file.match(/(?:^|\/)(?:\d+[-_])?(atoms|molecules|organisms|templates|pages)(?:\/|$)/)?.[1];
@@ -54358,24 +54700,24 @@ async function scanFacts(checkout, app) {
54358
54700
  return { name: name.slice(0, 120), ...parent && parent !== "." && parent !== name ? { group: parent.slice(0, 120) } : {}, path: file };
54359
54701
  }),
54360
54702
  ...patternFiles.slice(0, 200).map((file) => ({ name: posix3.basename(file).replace(/\.[^.]+$/, "").slice(0, 120), group: atomicLevel(file) ?? posix3.basename(posix3.dirname(file)), path: file }))
54361
- ].filter((c) => c.name && (0, import_validation.evidencePathAllowed)(c.path)).slice(0, 200);
54703
+ ].filter((c) => c.name && (0, import_validation2.evidencePathAllowed)(c.path)).slice(0, 200);
54362
54704
  const designSources = {};
54363
- const tokenPath = own4.find((file) => /(?:^|\/)(?:tokens\.json|style-dictionary(?:\.config)?\.[cm]?[jt]s|style-dictionary\.config\.json)$/.test(file) && (0, import_validation.evidencePathAllowed)(file));
54705
+ const tokenPath = own4.find((file) => /(?:^|\/)(?:tokens\.json|style-dictionary(?:\.config)?\.[cm]?[jt]s|style-dictionary\.config\.json)$/.test(file) && (0, import_validation2.evidencePathAllowed)(file));
54364
54706
  if (tokenPath) {
54365
54707
  designSources.tokens = { path: tokenPath, evidence: [tokenPath] };
54366
54708
  add("build", "design-tokens", null, tokenPath);
54367
54709
  }
54368
- const codeConnectPath = own4.find((file) => /(?:^|\/)figma\.config\.json$|\.figma\.[cm]?[jt]sx?$/.test(file) && (0, import_validation.evidencePathAllowed)(file));
54710
+ const codeConnectPath = own4.find((file) => /(?:^|\/)figma\.config\.json$|\.figma\.[cm]?[jt]sx?$/.test(file) && (0, import_validation2.evidencePathAllowed)(file));
54369
54711
  if (codeConnectPath) {
54370
54712
  designSources.codeConnect = { present: true, configPath: codeConnectPath };
54371
54713
  add("ui_library", "figma-code-connect", null, codeConnectPath);
54372
54714
  }
54373
- if (rootPath && patternFiles[0] && (0, import_validation.evidencePathAllowed)(rootPath)) designSources.components = { path: rootPath, evidence: [patternFiles[0]] };
54374
- const figmaSources = own4.filter((file) => /(?:^|\/)figma\.config\.json$|\.figma\.[cm]?[jt]sx?$/.test(file) && (0, import_validation.evidencePathAllowed)(file)).slice(0, 3);
54715
+ if (rootPath && patternFiles[0] && (0, import_validation2.evidencePathAllowed)(rootPath)) designSources.components = { path: rootPath, evidence: [patternFiles[0]] };
54716
+ const figmaSources = own4.filter((file) => /(?:^|\/)figma\.config\.json$|\.figma\.[cm]?[jt]sx?$/.test(file) && (0, import_validation2.evidencePathAllowed)(file)).slice(0, 3);
54375
54717
  for (const file of figmaSources) {
54376
54718
  const content3 = await readSmall2(checkout.root, file, INIT_SCAN_LIMITS.fileBytes);
54377
54719
  const url = content3?.match(/https:\/\/(?:www\.)?figma\.com\/(?:file|design)\/[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)?/)?.[0];
54378
- if (url && (0, import_validation.environmentUrlAllowed)(url)) {
54720
+ if (url && (0, import_validation2.environmentUrlAllowed)(url)) {
54379
54721
  designSources.figmaFile = { url, evidence: [file] };
54380
54722
  break;
54381
54723
  }
@@ -54391,7 +54733,7 @@ async function scanFacts(checkout, app) {
54391
54733
  const inputs = checkout.files.filter((file) => !ignored(file) && (file.startsWith(prefix) && stagingAllowed(file.slice(prefix.length)) || !!prefix && rootInput(file)));
54392
54734
  const environmentNames = [];
54393
54735
  const environment = (name, file) => {
54394
- if (!/^[A-Za-z][A-Za-z0-9_-]{0,59}$/.test(name) || !(0, import_validation.evidencePathAllowed)(file) || environmentNames.length >= 30) return;
54736
+ if (!/^[A-Za-z][A-Za-z0-9_-]{0,59}$/.test(name) || !(0, import_validation2.evidencePathAllowed)(file) || environmentNames.length >= 30) return;
54395
54737
  const known = environmentNames.find((entry) => entry.name === name);
54396
54738
  if (known) {
54397
54739
  if (!known.evidence.includes(file) && known.evidence.length < 3) known.evidence.push(file);
@@ -54434,7 +54776,7 @@ async function scanFacts(checkout, app) {
54434
54776
  }
54435
54777
  const base = {
54436
54778
  stack,
54437
- storybook: { present: stories.length > 0 || configPath !== null, configPath: configPath && (0, import_validation.evidencePathAllowed)(configPath) ? configPath : null, stories: stories.length },
54779
+ storybook: { present: stories.length > 0 || configPath !== null, configPath: configPath && (0, import_validation2.evidencePathAllowed)(configPath) ? configPath : null, stories: stories.length },
54438
54780
  locales,
54439
54781
  ci,
54440
54782
  docker,
@@ -54442,7 +54784,7 @@ async function scanFacts(checkout, app) {
54442
54784
  ...Object.keys(designSources).length ? { designSources } : {},
54443
54785
  ...environmentNames.length ? { environmentNames } : {}
54444
54786
  };
54445
- const factsHash = createHash7("sha256").update((0, import_validation.projectInitCanonical)(base)).digest("hex");
54787
+ const factsHash = createHash7("sha256").update((0, import_validation2.projectInitCanonical)(base)).digest("hex");
54446
54788
  return { facts: { ...base, factsHash }, components };
54447
54789
  }
54448
54790
  var ENV_EXAMPLE = /^\.env\.(?:example|sample|template)$/;
@@ -54481,7 +54823,7 @@ function stagingAllowed(relative3) {
54481
54823
  if (segments.some((segment) => STAGING_DENY.test(segment))) return false;
54482
54824
  const name = posix3.basename(relative3);
54483
54825
  const checkedPath = ENV_EXAMPLE.test(name) ? [...segments.slice(0, -1), "env-example"].join("/") : relative3;
54484
- if (!(0, import_validation.evidencePathAllowed)(checkedPath)) return false;
54826
+ if (!(0, import_validation2.evidencePathAllowed)(checkedPath)) return false;
54485
54827
  if (/(?:^|[-.])lock(?:file)?(?:\.|$)|\.lock$|-lock\.|^yarn\.lock$|^pnpm-lock\.yaml$|^package-lock\.json$|^composer\.lock$|^Gemfile\.lock$|^go\.sum$/i.test(name)) return false;
54486
54828
  return ENV_EXAMPLE.test(name) || STAGING_ALLOW.some((pattern) => pattern.test(name)) || STAGING_ALLOW_PATH.some((pattern) => pattern.test(relative3));
54487
54829
  }
@@ -54566,7 +54908,7 @@ async function stageApplication(checkout, app, dir) {
54566
54908
  }
54567
54909
  const sourceBytes = bytes.length;
54568
54910
  if (envExample) bytes = Buffer.from(environmentKeys(bytes.toString("utf8")), "utf8");
54569
- if (designInputFile(file) && (0, import_validation.credentialShapeOf)(bytes.toString("utf8"))) {
54911
+ if (designInputFile(file) && (0, import_validation2.credentialShapeOf)(bytes.toString("utf8"))) {
54570
54912
  skipped++;
54571
54913
  continue;
54572
54914
  }
@@ -55717,7 +56059,7 @@ function parseListing(result) {
55717
56059
  const seen = /* @__PURE__ */ new Set();
55718
56060
  return kits.map((raw) => {
55719
56061
  const k = raw;
55720
- if (!k || typeof k !== "object" || !isKitKey(k.kitKey) || seen.has(k.kitKey) || !KIT_KINDS.includes(String(k.kind)) || !import_types7.PROJECT_MEMBER_ROLES.includes(String(k.role)) || !Number.isSafeInteger(k.version) || k.version < 1 || typeof k.versionId !== "string" || !UUID.test(k.versionId) || typeof k.contentHash !== "string" || !/^[0-9a-f]{64}$/.test(k.contentHash) || !KIT_PLACEMENTS.includes(String(k.placement)) || !Number.isSafeInteger(k.parts) || k.parts < 1 || k.parts > KIT_MAX_PARTS) {
56062
+ if (!k || typeof k !== "object" || !isKitKey(k.kitKey) || seen.has(k.kitKey) || !KIT_KINDS.includes(String(k.kind)) || !import_types8.PROJECT_MEMBER_ROLES.includes(String(k.role)) || !Number.isSafeInteger(k.version) || k.version < 1 || typeof k.versionId !== "string" || !UUID.test(k.versionId) || typeof k.contentHash !== "string" || !/^[0-9a-f]{64}$/.test(k.contentHash) || !KIT_PLACEMENTS.includes(String(k.placement)) || !Number.isSafeInteger(k.parts) || k.parts < 1 || k.parts > KIT_MAX_PARTS) {
55721
56063
  throw protocol("listing");
55722
56064
  }
55723
56065
  seen.add(k.kitKey);
@@ -56755,7 +57097,7 @@ async function kitRun(ctx, client, values, userArgs) {
56755
57097
 
56756
57098
  // src/init.ts
56757
57099
  import { createHash as createHash8, randomUUID as randomUUID4 } from "node:crypto";
56758
- var import_validation2 = __toESM(require_dist2(), 1);
57100
+ var import_validation3 = __toESM(require_dist2(), 1);
56759
57101
  import { constants as fsConstants5 } from "node:fs";
56760
57102
  import { lstat as lstat13, mkdir as mkdir10, mkdtemp as mkdtemp2, open as open6, readdir as readdir12, realpath as realpath17, rename as rename4, rm as rm11, writeFile as writeFile6 } from "node:fs/promises";
56761
57103
  import { tmpdir } from "node:os";
@@ -56846,11 +57188,11 @@ function instructions2(ctx, app, facts) {
56846
57188
  "",
56847
57189
  ...projectFactLines(de, facts),
56848
57190
  de ? "## Ausgabe" : "## Output",
56849
- de ? `Liefere genau ein JSON-Objekt: beim gedruckten manuellen Befehl nur JSON auf stdout (der Befehl schreibt atomar), sonst genau eine JSON-Datei \`agent-output.json\` im Ausgabeverzeichnis (erst \`.tmp\`, dann umbenennen), Format \`${import_validation2.PROJECT_INIT_AGENT_FORMAT}\`:` : `Return exactly one JSON object: with the printed manual command, only JSON on stdout (the command writes atomically), otherwise exactly one JSON file \`agent-output.json\` in the output directory (write \`.tmp\` first, then rename), format \`${import_validation2.PROJECT_INIT_AGENT_FORMAT}\`:`,
57191
+ de ? `Liefere genau ein JSON-Objekt: beim gedruckten manuellen Befehl nur JSON auf stdout (der Befehl schreibt atomar), sonst genau eine JSON-Datei \`agent-output.json\` im Ausgabeverzeichnis (erst \`.tmp\`, dann umbenennen), Format \`${import_validation3.PROJECT_INIT_AGENT_FORMAT}\`:` : `Return exactly one JSON object: with the printed manual command, only JSON on stdout (the command writes atomically), otherwise exactly one JSON file \`agent-output.json\` in the output directory (write \`.tmp\` first, then rename), format \`${import_validation3.PROJECT_INIT_AGENT_FORMAT}\`:`,
56850
57192
  "",
56851
57193
  "```json",
56852
57194
  JSON.stringify({
56853
- format: import_validation2.PROJECT_INIT_AGENT_FORMAT,
57195
+ format: import_validation3.PROJECT_INIT_AGENT_FORMAT,
56854
57196
  sections: { overview: "…", architecture: "…", componentsNote: "…", cmsNote: "…", integrationsNote: "…" },
56855
57197
  components: [{ name: "Button", group: "Basis", note: "…" }],
56856
57198
  cms: null,
@@ -56863,7 +57205,7 @@ function instructions2(ctx, app, facts) {
56863
57205
  }, null, 2),
56864
57206
  "```",
56865
57207
  "",
56866
- de ? `Grenzen: Abschnitte ≤ ${import_validation2.PROJECT_INIT_LIMITS.section} Zeichen, Hinweise ≤ ${import_validation2.PROJECT_INIT_LIMITS.reviewHints}, Datei ≤ 64 KiB. Einfacher Text mit Absätzen und Spiegelstrichen.` : `Bounds: sections <= ${import_validation2.PROJECT_INIT_LIMITS.section} characters, hints <= ${import_validation2.PROJECT_INIT_LIMITS.reviewHints}, file <= 64 KiB. Plain text with paragraphs and bullets.`
57208
+ de ? `Grenzen: Abschnitte ≤ ${import_validation3.PROJECT_INIT_LIMITS.section} Zeichen, Hinweise ≤ ${import_validation3.PROJECT_INIT_LIMITS.reviewHints}, Datei ≤ 64 KiB. Einfacher Text mit Absätzen und Spiegelstrichen.` : `Bounds: sections <= ${import_validation3.PROJECT_INIT_LIMITS.section} characters, hints <= ${import_validation3.PROJECT_INIT_LIMITS.reviewHints}, file <= 64 KiB. Plain text with paragraphs and bullets.`
56867
57209
  ].join("\n");
56868
57210
  }
56869
57211
  function projectFactLines(de, facts) {
@@ -56952,7 +57294,7 @@ async function startAgent(ctx, values, stagingDir, outputFile, timeoutMs, app) {
56952
57294
  env,
56953
57295
  signal: ctx.deps.signal,
56954
57296
  timeoutMs: Math.max(1, timeoutMs),
56955
- maxBytes: import_validation2.PROJECT_INIT_LIMITS.summaryBytes
57297
+ maxBytes: import_validation3.PROJECT_INIT_LIMITS.summaryBytes
56956
57298
  }));
56957
57299
  if (result.code !== 0) throw new CliError("errors.initAgentFailed", EXIT.failed, { code: result.code }, "AGENT_FAILED");
56958
57300
  const temporary = `${outputFile}.tmp`;
@@ -57080,7 +57422,7 @@ async function initCommand(ctx, values) {
57080
57422
  if (!apps.includes(app)) apps.push(app);
57081
57423
  }
57082
57424
  } else if (tty) {
57083
- const max = import_validation2.PROJECT_INIT_LIMITS.applicationsPerRun;
57425
+ const max = import_validation3.PROJECT_INIT_LIMITS.applicationsPerRun;
57084
57426
  const defaults = candidates.filter((app) => !app.library).slice(0, max);
57085
57427
  const lines = [
57086
57428
  ctx.t("init.selectHeading", { count: candidates.length, max }),
@@ -57103,7 +57445,7 @@ async function initCommand(ctx, values) {
57103
57445
  if (picked === null) throw usage3("errors.initSelection", { max, project: values.project, app: candidates[0]?.key ?? "app" });
57104
57446
  apps = picked;
57105
57447
  } else throw usage3("errors.initYesNeedsApp");
57106
- if (apps.length > import_validation2.PROJECT_INIT_LIMITS.applicationsPerRun) throw usage3("errors.initTooManyApps", { max: import_validation2.PROJECT_INIT_LIMITS.applicationsPerRun });
57448
+ if (apps.length > import_validation3.PROJECT_INIT_LIMITS.applicationsPerRun) throw usage3("errors.initTooManyApps", { max: import_validation3.PROJECT_INIT_LIMITS.applicationsPerRun });
57107
57449
  if (!apps.length) throw usage3("errors.initNoApps");
57108
57450
  const existing = context.applications.filter((entry) => entry.name !== null && APPLICATION_KEY.test(entry.key));
57109
57451
  const mapping = await mapApplications(ctx, apps, explicit, existing, tty && !values.yes, values.verbose);
@@ -57250,20 +57592,20 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57250
57592
  const staged = await stageApplication(checkout, app, stagingDir);
57251
57593
  const applicationKey = application.key;
57252
57594
  const input = {
57253
- format: import_validation2.PROJECT_INIT_INPUT_FORMAT,
57595
+ format: import_validation3.PROJECT_INIT_INPUT_FORMAT,
57254
57596
  application: { key: applicationKey, name: application.name, path: app.path, kind: app.kind },
57255
57597
  facts,
57256
57598
  files: staged.files,
57257
57599
  base: known?.base ?? null,
57258
57600
  statements: Array.isArray(known?.statements) ? known.statements.slice(0, 100) : [],
57259
- outputFormat: import_validation2.PROJECT_INIT_AGENT_FORMAT
57601
+ outputFormat: import_validation3.PROJECT_INIT_AGENT_FORMAT
57260
57602
  };
57261
57603
  const inputFile = join29(stagingDir, "fleek-input.json"), instructionsFile = join29(stagingDir, "FLEEK-INIT.md"), outputFile = join29(outputDir, "agent-output.json");
57262
57604
  await writeFile6(inputFile, `${JSON.stringify(input, null, 2)}
57263
57605
  `, { mode: 256 });
57264
57606
  await writeFile6(instructionsFile, `${instructions2(ctx, app, facts)}
57265
57607
  `, { mode: 256 });
57266
- const stagingDigest = createHash8("sha256").update(JSON.stringify([import_validation2.PROJECT_INIT_FORMAT, INIT_CLI_VERSION, staged.digest, facts.factsHash, input.base, input.statements])).digest("hex");
57608
+ const stagingDigest = createHash8("sha256").update(JSON.stringify([import_validation3.PROJECT_INIT_FORMAT, INIT_CLI_VERSION, staged.digest, facts.factsHash, input.base, input.statements])).digest("hex");
57267
57609
  const idempotencyKey = values.yes ? `pi-${createHash8("sha256").update(JSON.stringify([context.project.teamId, applicationKey, checkout.commit, stagingDigest])).digest("hex")}` : `pi-${createHash8("sha256").update(`${runId}:${app.key}`).digest("hex")}`;
57268
57610
  if (values.yes && !values["dry-run"] && (await client.availableTools()).has(ACTION_STATUS_TOOL)) {
57269
57611
  const status = await client.callTool(ACTION_STATUS_TOOL, { action: WIRE.projectInitSubmit, idempotencyKey }).then((r) => r.structured).catch(() => null);
@@ -57302,18 +57644,18 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57302
57644
  let raw;
57303
57645
  try {
57304
57646
  const seen = await lstat13(outputFile);
57305
- if (!seen.isFile() || seen.nlink !== 1 || seen.size > import_validation2.PROJECT_INIT_LIMITS.summaryBytes) throw new Error("not a bounded file");
57647
+ if (!seen.isFile() || seen.nlink !== 1 || seen.size > import_validation3.PROJECT_INIT_LIMITS.summaryBytes) throw new Error("not a bounded file");
57306
57648
  const handle = await open6(outputFile, fsConstants5.O_RDONLY | (fsConstants5.O_NOFOLLOW ?? 0) | (fsConstants5.O_NONBLOCK ?? 0));
57307
57649
  try {
57308
57650
  const info = await handle.stat();
57309
57651
  if (!info.isFile() || info.ino !== seen.ino || info.dev !== seen.dev || info.nlink !== 1) throw new Error("replaced");
57310
- const buffer = Buffer.alloc(import_validation2.PROJECT_INIT_LIMITS.summaryBytes + 1);
57652
+ const buffer = Buffer.alloc(import_validation3.PROJECT_INIT_LIMITS.summaryBytes + 1);
57311
57653
  let length = 0;
57312
57654
  for (; ; ) {
57313
57655
  const { bytesRead } = await handle.read(buffer, length, buffer.length - length, length);
57314
57656
  if (bytesRead === 0) break;
57315
57657
  length += bytesRead;
57316
- if (length > import_validation2.PROJECT_INIT_LIMITS.summaryBytes) throw new Error("too large");
57658
+ if (length > import_validation3.PROJECT_INIT_LIMITS.summaryBytes) throw new Error("too large");
57317
57659
  }
57318
57660
  raw = JSON.parse(buffer.subarray(0, length).toString("utf8"));
57319
57661
  } finally {
@@ -57322,33 +57664,33 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57322
57664
  } catch {
57323
57665
  raw = void 0;
57324
57666
  }
57325
- const agentOutput = raw === void 0 ? null : (0, import_validation2.parseProjectInitAgentOutput)(raw);
57667
+ const agentOutput = raw === void 0 ? null : (0, import_validation3.parseProjectInitAgentOutput)(raw);
57326
57668
  if (!agentOutput?.ok) {
57327
57669
  emit(ctx, { event: "error", app: app.key, code: "output_invalid" });
57328
57670
  if (!ctx.json) ctx.out.error(ctx.out.style.fail(ctx.t("init.outputInvalid", { app: app.key, field: agentOutput && !agentOutput.ok ? agentOutput.issues[0]?.path || "-" : "-" })));
57329
57671
  return "failed";
57330
57672
  }
57331
- const composed = (0, import_validation2.composeProjectInitSummary)({
57673
+ const composed = (0, import_validation3.composeProjectInitSummary)({
57332
57674
  application: { key: applicationKey, name: application.name, path: app.path, kind: app.kind },
57333
57675
  source: { commit: checkout.commit, dirty: checkout.dirty, analyzedAt: new Date(ctx.now()).toISOString(), cliVersion: INIT_CLI_VERSION, kitVersion: null, agent: started ? "claude_code" : "manual" },
57334
57676
  facts,
57335
57677
  components
57336
57678
  }, agentOutput.value, input.statements);
57337
- const parsed = (0, import_validation2.parseProjectInitSummary)(composed);
57679
+ const parsed = (0, import_validation3.parseProjectInitSummary)(composed);
57338
57680
  if (!parsed.ok) {
57339
57681
  emit(ctx, { event: "error", app: app.key, code: "output_invalid" });
57340
57682
  if (!ctx.json) ctx.out.error(ctx.out.style.fail(ctx.t("init.outputInvalid", { app: app.key, field: parsed.issues[0]?.path || "-" })));
57341
57683
  return "failed";
57342
57684
  }
57343
- const findings = (0, import_validation2.scanProjectInit)(parsed.value);
57344
- const summary = (0, import_validation2.stripProjectInitFindings)(parsed.value, findings);
57685
+ const findings = (0, import_validation3.scanProjectInit)(parsed.value);
57686
+ const summary = (0, import_validation3.stripProjectInitFindings)(parsed.value, findings);
57345
57687
  const removed = findings.map((finding) => ({ path: finding.path, reason: finding.reason }));
57346
57688
  if (!summary) {
57347
57689
  emit(ctx, { event: "error", app: app.key, code: "application_unusable" });
57348
57690
  if (!ctx.json) ctx.out.error(ctx.out.style.fail(ctx.t("init.unusable", { app: app.key })));
57349
57691
  return "failed";
57350
57692
  }
57351
- const warnings = (0, import_validation2.projectInitWarnings)(summary).length;
57693
+ const warnings = (0, import_validation3.projectInitWarnings)(summary).length;
57352
57694
  emit(ctx, { event: "checked", app: app.key, removed, warnings });
57353
57695
  if (!ctx.json) {
57354
57696
  const s = ctx.out.style;
@@ -57400,7 +57742,7 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57400
57742
  }
57401
57743
 
57402
57744
  // src/service.ts
57403
- var import_types8 = __toESM(require_dist(), 1);
57745
+ var import_types9 = __toESM(require_dist(), 1);
57404
57746
  import { spawn as spawn8 } from "node:child_process";
57405
57747
  import { randomBytes as randomBytes11, randomUUID as randomUUID5 } from "node:crypto";
57406
57748
  import { constants as fsConstants6 } from "node:fs";
@@ -57502,7 +57844,7 @@ var TokenFilter = class {
57502
57844
  var usage4 = () => new CliError("errors.usage", EXIT.usage, {}, "USAGE");
57503
57845
  function normalizeSetupCode(value) {
57504
57846
  const code = (value ?? "").toUpperCase().replace(/[\s-]/g, "");
57505
- if (code.length !== import_types8.SERVICE_ACCOUNT_USER_CODE_LENGTH || [...code].some((char) => !import_types8.SERVICE_ACCOUNT_USER_CODE_CHARSET.includes(char))) throw usage4();
57847
+ if (code.length !== import_types9.SERVICE_ACCOUNT_USER_CODE_LENGTH || [...code].some((char) => !import_types9.SERVICE_ACCOUNT_USER_CODE_CHARSET.includes(char))) throw usage4();
57506
57848
  return code;
57507
57849
  }
57508
57850
  function serverArg(value) {
@@ -58386,7 +58728,7 @@ function realSystem(options = {}) {
58386
58728
  }
58387
58729
 
58388
58730
  // src/setup.ts
58389
- var import_types9 = __toESM(require_dist(), 1);
58731
+ var import_types10 = __toESM(require_dist(), 1);
58390
58732
  import { hostname } from "node:os";
58391
58733
  import { join as join32, resolve as resolve8 } from "node:path";
58392
58734
  import { realpath as realpath19 } from "node:fs/promises";
@@ -58549,7 +58891,7 @@ function createSetupProxyAdapter(ctx) {
58549
58891
  // src/setup.ts
58550
58892
  async function setupCommand(ctx, code, values) {
58551
58893
  const normalized = (code ?? "").replace(/-/g, "").toUpperCase();
58552
- if (normalized.length !== 8 || [...normalized].some((char) => !import_types9.SERVICE_ACCOUNT_USER_CODE_CHARSET.includes(char))) {
58894
+ if (normalized.length !== 8 || [...normalized].some((char) => !import_types10.SERVICE_ACCOUNT_USER_CODE_CHARSET.includes(char))) {
58553
58895
  throw new CliError("errors.setupCode", EXIT.usage, {}, "INVALID_SETUP_CODE");
58554
58896
  }
58555
58897
  registerSecret(code);
@@ -59225,7 +59567,7 @@ function derivedClientId(origin) {
59225
59567
  const url = new URL(origin);
59226
59568
  const labels = url.hostname.split(".");
59227
59569
  if (url.protocol !== "https:" || labels.length < 3) return null;
59228
- return (0, import_types10.fleekCliClientId)(`https://app.${labels.slice(1).join(".")}`);
59570
+ return (0, import_types11.fleekCliClientId)(`https://app.${labels.slice(1).join(".")}`);
59229
59571
  }
59230
59572
  function validClientId(value) {
59231
59573
  let url;
@@ -59425,7 +59767,7 @@ async function login(ctx, values, guided = false) {
59425
59767
  throw new CliError(pending.expiresAt <= ctx.now() ? "errors.setupDeviceExpired" : "errors.setupDeviceRestart", EXIT.needsLogin, {}, "EXPIRED_TOKEN");
59426
59768
  }
59427
59769
  registerSecret(pending.accessToken);
59428
- const uri = `${(0, import_types10.serviceDeviceVerificationOrigin)(info.issuer)}/device`;
59770
+ const uri = `${(0, import_types11.serviceDeviceVerificationOrigin)(info.issuer)}/device`;
59429
59771
  device = {
59430
59772
  deviceCode: pending.accessToken,
59431
59773
  userCode: saved.userCode,
@@ -59710,7 +60052,7 @@ async function work(ctx, sub, args, values) {
59710
60052
  WIRE.claim,
59711
60053
  {
59712
60054
  issueId: id,
59713
- purpose: oneOf2(values.purpose, import_types10.CLAIM_PURPOSES) ?? "work",
60055
+ purpose: oneOf2(values.purpose, import_types11.CLAIM_PURPOSES) ?? "work",
59714
60056
  ...values.ttl ? { ttlMinutes: int(values.ttl, 1, 1440) } : {},
59715
60057
  ...values.note ? { note: text5(values.note, 280) } : {}
59716
60058
  },
@@ -59729,7 +60071,7 @@ async function work(ctx, sub, args, values) {
59729
60071
  );
59730
60072
  case "release":
59731
60073
  case "complete": {
59732
- const outcome = sub === "release" ? oneOf2(values.outcome, import_types10.CLAIM_RELEASE_OUTCOMES, true) : oneOf2(values.outcome, import_types10.CLAIM_COMPLETE_OUTCOMES, true);
60074
+ const outcome = sub === "release" ? oneOf2(values.outcome, import_types11.CLAIM_RELEASE_OUTCOMES, true) : oneOf2(values.outcome, import_types11.CLAIM_COMPLETE_OUTCOMES, true);
59733
60075
  return write(
59734
60076
  ctx,
59735
60077
  client,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logic-joe/fleek",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "fleek - command line client for the Fleek agent hub (MCP over OAuth, OS keychain, signed role/project kits)",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",