@logic-joe/fleek 0.2.10 → 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 +444 -89
  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.10";
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
 
@@ -31856,8 +31891,8 @@ var require_secret_shape = __commonJS({
31856
31891
  }
31857
31892
  return hostEnd > start2;
31858
31893
  }
31859
- function scanUrl(text6, start2, end, sep11) {
31860
- const authorityStart = sep11 + 3;
31894
+ function scanUrl(text6, start2, end, sep10) {
31895
+ const authorityStart = sep10 + 3;
31861
31896
  let authorityEnd = authorityStart;
31862
31897
  while (authorityEnd < end) {
31863
31898
  const code = text6.charCodeAt(authorityEnd);
@@ -31868,7 +31903,7 @@ var require_secret_shape = __commonJS({
31868
31903
  for (let i2 = authorityStart; i2 < authorityEnd; i2++)
31869
31904
  if (text6.charCodeAt(i2) === 64)
31870
31905
  return "url_userinfo";
31871
- const scheme = lowerAscii(text6, start2, sep11);
31906
+ const scheme = lowerAscii(text6, start2, sep10);
31872
31907
  if (scheme !== "https" && scheme !== "http" || !validUrlHost(text6, authorityStart, authorityEnd))
31873
31908
  return scanTokens(text6, start2, end, true);
31874
31909
  const head = lowerAscii(text6, start2, Math.min(end, start2 + 48));
@@ -31907,9 +31942,9 @@ var require_secret_shape = __commonJS({
31907
31942
  }
31908
31943
  return null;
31909
31944
  }
31910
- function schemeStart(text6, sep11, floor) {
31911
- let s = sep11;
31912
- const limit = Math.max(floor, sep11 - 32);
31945
+ function schemeStart(text6, sep10, floor) {
31946
+ let s = sep10;
31947
+ const limit = Math.max(floor, sep10 - 32);
31913
31948
  while (s > limit) {
31914
31949
  const code = text6.charCodeAt(s - 1);
31915
31950
  const letter = code >= 65 && code <= 90 || code >= 97 && code <= 122;
@@ -31918,7 +31953,7 @@ var require_secret_shape = __commonJS({
31918
31953
  else
31919
31954
  break;
31920
31955
  }
31921
- while (s < sep11) {
31956
+ while (s < sep10) {
31922
31957
  const code = text6.charCodeAt(s);
31923
31958
  if (code >= 65 && code <= 90 || code >= 97 && code <= 122)
31924
31959
  return s;
@@ -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,16 +36424,17 @@ 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
- import { realpath as realpath20, rm as rm13 } from "node:fs/promises";
36435
+ import { rm as rm13 } from "node:fs/promises";
36101
36436
  import { hostname as osHostname2 } from "node:os";
36102
- import { join as join33, sep as sep10 } from "node:path";
36437
+ import { join as join33 } from "node:path";
36103
36438
  import { parseArgs } from "node:util";
36104
36439
 
36105
36440
  // src/config.ts
@@ -37311,7 +37646,8 @@ var EN = {
37311
37646
  "kit.offline": "Server not reachable: status unknown. The installed kits keep working.",
37312
37647
  "kit.doubleE1": "{target}: Fleek Work Protocol installed twice (global and bundle). Run fleek kit pull again.",
37313
37648
  "kit.disabled": "{kit} removed from the bundle.",
37314
- "kit.cleanupPending": "Not cleaned up yet ({reason}): withdrawn kit files are still in {path}. Fix it and run fleek kit status again.",
37649
+ "kit.cleanupPending": "Not cleaned up yet ({reason}): withdrawn kit files are still in {path}. Fix it and run {command}.",
37650
+ "kit.cleanupPendingSummary": "Not cleaned up yet ({reason}): withdrawn kit files are still in {path}.",
37315
37651
  "kit.none": "No kits.",
37316
37652
  "kit.installed": "installed: {version}",
37317
37653
  "kit.localLine": "{project}: {kits}",
@@ -37493,7 +37829,7 @@ var EN = {
37493
37829
  "errors.kitProjectRequired": "Which project? Pass --project <key or id> (or run it in a pulled checkout).",
37494
37830
  "errors.kitKeyUnknown": "No project you can access has the key {key}.",
37495
37831
  "kit.formerOffline": "Could not check former project {project} (offline) - it is checked again next time.",
37496
- "errors.kitRunCleanupPending": "Withdrawn kit parts are still in {path} (cleanup pending). Not started - fix the reported problem, then run fleek kit status.",
37832
+ "errors.kitRunCleanupPending": "Withdrawn kit parts from project {project} remain in {path}. Fix the reported problem, then run {command}.",
37497
37833
  "errors.kitRunCodexCheckout": "Codex reads kit skills only inside a project checkout. Start fleek kit run codex in the project's git checkout.",
37498
37834
  "errors.kitNoCheckout": "Not a git checkout.",
37499
37835
  "errors.kitNotPulled": "No kits pulled for {project}.",
@@ -38076,7 +38412,8 @@ var DE = {
38076
38412
  "kit.offline": "Server nicht erreichbar: Status unbekannt. Die installierten Kits funktionieren weiter.",
38077
38413
  "kit.doubleE1": "{target}: Fleek Work Protocol doppelt installiert (global und im Bundle). Führe fleek kit pull erneut aus.",
38078
38414
  "kit.disabled": "{kit} aus dem Bundle entfernt.",
38079
- "kit.cleanupPending": "Noch nicht aufgeräumt ({reason}): Zurückgezogene Kit-Dateien liegen noch in {path}. Behebe das und führe fleek kit status erneut aus.",
38415
+ "kit.cleanupPending": "Noch nicht aufgeräumt ({reason}): Zurückgezogene Kit-Dateien liegen noch in {path}. Behebe das und führe {command} aus.",
38416
+ "kit.cleanupPendingSummary": "Noch nicht aufgeräumt ({reason}): Zurückgezogene Kit-Dateien liegen noch in {path}.",
38080
38417
  "kit.none": "Keine Kits.",
38081
38418
  "kit.installed": "installiert: {version}",
38082
38419
  "kit.localLine": "{project}: {kits}",
@@ -38258,7 +38595,7 @@ var DE = {
38258
38595
  "errors.kitProjectRequired": "Welches Projekt? Nutze --project <Schlüssel oder ID> (oder führe es in einem Checkout mit geholten Kits aus).",
38259
38596
  "errors.kitKeyUnknown": "Kein Projekt, auf das du zugreifen kannst, hat den Schlüssel {key}.",
38260
38597
  "kit.formerOffline": "Früheres Projekt {project} konnte nicht geprüft werden (offline) - es wird beim nächsten Mal erneut geprüft.",
38261
- "errors.kitRunCleanupPending": "Zurückgezogene Kit-Teile liegen noch in {path} (Bereinigung ausstehend). Nicht gestartet - behebe das gemeldete Problem und führe dann fleek kit status aus.",
38598
+ "errors.kitRunCleanupPending": "Zurückgezogene Kit-Teile aus Projekt {project} liegen noch in {path}. Behebe das gemeldete Problem und führe dann {command} aus.",
38262
38599
  "errors.kitRunCodexCheckout": "Codex liest Kit-Skills nur in einem Projekt-Checkout. Starte fleek kit run codex im Git-Checkout des Projekts.",
38263
38600
  "errors.kitNoCheckout": "Kein Git-Checkout.",
38264
38601
  "errors.kitNotPulled": "Für {project} sind keine Kits geholt.",
@@ -39764,6 +40101,8 @@ async function serveMcp(client, options) {
39764
40101
  }
39765
40102
 
39766
40103
  // src/mcp-proxy.ts
40104
+ var import_types3 = __toESM(require_dist(), 1);
40105
+ var import_validation = __toESM(require_dist2(), 1);
39767
40106
  var PROXY_LEGACY_VERSIONS = ["2025-11-25", "2025-06-18"];
39768
40107
  var DEFAULT_VERSION = PROXY_LEGACY_VERSIONS[0];
39769
40108
  var LINE_LIMIT = 1024 * 1024;
@@ -39906,12 +40245,17 @@ async function runProxy(options) {
39906
40245
  }
39907
40246
  if (response.status >= 400) {
39908
40247
  let code = response.status === 403 ? "ACCESS_DENIED" : response.status === 413 ? "CONTENT_TOO_LARGE" : "INVALID_INPUT";
40248
+ let details;
39909
40249
  try {
39910
40250
  const parsed = JSON.parse(raw);
39911
- 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
+ }
39912
40256
  } catch {
39913
40257
  }
39914
- 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 } : {}));
39915
40259
  }
39916
40260
  throw new TransientError(response.status);
39917
40261
  }
@@ -48097,7 +48441,7 @@ function kitContentHash(content3) {
48097
48441
  }
48098
48442
 
48099
48443
  // ../kit-format/dist/payload.js
48100
- var import_types3 = __toESM(require_dist(), 1);
48444
+ var import_types4 = __toESM(require_dist(), 1);
48101
48445
  var KIT_VERSION_PURPOSE = "fleek-kit/1";
48102
48446
  var KIT_STATUS_PURPOSE = "fleek-kit-status/1";
48103
48447
  var KIT_STATUS_STATES = ["current", "superseded", "revoked", "unsigned", "not_entitled"];
@@ -48169,7 +48513,7 @@ function parseVersionAttestationPayload(value) {
48169
48513
  workspaceId: matching(p.workspaceId, UUID, "$.workspaceId"),
48170
48514
  kitKey: kitKeyOf(p.kitKey, "$.kitKey"),
48171
48515
  kind: oneOf(p.kind, KIT_KINDS, "$.kind"),
48172
- role: oneOf(p.role, import_types3.PROJECT_MEMBER_ROLES, "$.role"),
48516
+ role: oneOf(p.role, import_types4.PROJECT_MEMBER_ROLES, "$.role"),
48173
48517
  audienceClass,
48174
48518
  clientGroupId,
48175
48519
  version: version(p.version, "$.version"),
@@ -48200,7 +48544,7 @@ function parseStatusPayload(value) {
48200
48544
  return {
48201
48545
  kitKey: kitKeyOf(e.kitKey, `${path}.kitKey`),
48202
48546
  kind: oneOf(e.kind, KIT_KINDS, `${path}.kind`),
48203
- role: oneOf(e.role, import_types3.PROJECT_MEMBER_ROLES, `${path}.role`),
48547
+ role: oneOf(e.role, import_types4.PROJECT_MEMBER_ROLES, `${path}.role`),
48204
48548
  pinnedVersion: version(e.pinnedVersion, `${path}.pinnedVersion`)
48205
48549
  };
48206
48550
  });
@@ -48898,7 +49242,7 @@ function projectFactsForStack(products, catalog = LJ_TECHNOLOGY_CATALOG) {
48898
49242
  }
48899
49243
 
48900
49244
  // src/kit-store.ts
48901
- var import_types4 = __toESM(require_dist(), 1);
49245
+ var import_types5 = __toESM(require_dist(), 1);
48902
49246
  var STATE_VERSION = 1;
48903
49247
  var GEN = /^gen-[0-9a-f]{24}$/;
48904
49248
  var corrupt2 = (path) => new CliError("errors.kitStateCorrupt", EXIT.failed, { path }, "KIT_STATE_CORRUPT");
@@ -48911,7 +49255,7 @@ function validState(value, profileKey2, projectId) {
48911
49255
  if (typeof s.workspaceId !== "string" || typeof s.issuer !== "string" || !Array.isArray(s.kits) || s.kits.length > 64) return false;
48912
49256
  if (!s.targets || typeof s.targets !== "object" || !s.checkouts || typeof s.checkouts !== "object" || !Array.isArray(s.mcp) || typeof s.checkoutMode !== "boolean") return false;
48913
49257
  for (const kit2 of s.kits) {
48914
- 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;
48915
49259
  }
48916
49260
  for (const target of Object.keys(s.targets)) if (!KIT_TARGETS.includes(target)) return false;
48917
49261
  if (s.undecided !== void 0 && (!s.undecided || typeof s.undecided !== "object" || Array.isArray(s.undecided))) return false;
@@ -49676,7 +50020,7 @@ async function orcaPick(deps, values, start2) {
49676
50020
  }
49677
50021
 
49678
50022
  // src/start.ts
49679
- var import_types5 = __toESM(require_dist(), 1);
50023
+ var import_types6 = __toESM(require_dist(), 1);
49680
50024
  import { basename as basename2, dirname as dirname6, isAbsolute as isAbsolute6 } from "node:path";
49681
50025
 
49682
50026
  // src/mutation.ts
@@ -49761,7 +50105,7 @@ async function liveFacts(client, task) {
49761
50105
  let step = null;
49762
50106
  if (stateId && tools.has("fleek_list_workflow_states")) {
49763
50107
  const state = (await pages(client, "fleek_list_workflow_states", { teamId: task.projectId }, 200)).find((row) => string3(row.id).toLowerCase() === stateId);
49764
- step = state && (0, import_types5.isOpenInStep)(state.role) ? state.role : null;
50108
+ step = state && (0, import_types6.isOpenInStep)(state.role) ? state.role : null;
49765
50109
  }
49766
50110
  return { step, claims, providers };
49767
50111
  }
@@ -49881,8 +50225,8 @@ function receiptOf(run2) {
49881
50225
  };
49882
50226
  }
49883
50227
  function promptOf(profile, task, step, role, lang, claim) {
49884
- const text6 = (0, import_types5.openInStartText)({ workspace: profile.workspace.slug, ticket: task.key, step, role, locale: lang, claim });
49885
- 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;
49886
50230
  }
49887
50231
  async function runStart(deps, input) {
49888
50232
  const { profile, task, root, program } = input;
@@ -49947,7 +50291,7 @@ async function runStart(deps, input) {
49947
50291
  key: task.key,
49948
50292
  title: neutralizeLine(task.title).slice(0, 120),
49949
50293
  agent: agent === "codex" ? "Codex" : agent === "claude" ? "Claude" : neutralizeLine(agent).slice(0, 32),
49950
- task: (0, import_types5.openInTask)(step, role, cliLang)
50294
+ task: (0, import_types6.openInTask)(step, role, cliLang)
49951
50295
  };
49952
50296
  const state = delivered ? { branch: neutralizeLine(delivered.branch), sha: delivered.sha.slice(0, 10), date: delivered.date } : null;
49953
50297
  const question = [
@@ -53424,12 +53768,12 @@ async function validProgram(program, configDir) {
53424
53768
  }
53425
53769
 
53426
53770
  // src/link.ts
53427
- var import_types6 = __toESM(require_dist(), 1);
53771
+ var import_types7 = __toESM(require_dist(), 1);
53428
53772
  import { stat as stat13 } from "node:fs/promises";
53429
53773
  import { dirname as dirname17 } from "node:path";
53430
- var LINK_SCHEME = import_types6.OPEN_IN_LINK_SCHEME;
53774
+ var LINK_SCHEME = import_types7.OPEN_IN_LINK_SCHEME;
53431
53775
  function parseFleekLink(input) {
53432
- const link3 = (0, import_types6.parseOpenInLink)(input);
53776
+ const link3 = (0, import_types7.parseOpenInLink)(input);
53433
53777
  return link3 ? { action: "orca-open", ...link3 } : null;
53434
53778
  }
53435
53779
  var refused = (key, code, params = {}) => new CliError(key, EXIT.failed, params, code);
@@ -53962,7 +54306,7 @@ import { spawn as spawn7 } from "node:child_process";
53962
54306
  import { randomBytes as randomBytes10 } from "node:crypto";
53963
54307
  import { readFile as readFile21, realpath as realpath16 } from "node:fs/promises";
53964
54308
  import { isAbsolute as isAbsolute10, join as join28, resolve as resolve6, sep as sep8 } from "node:path";
53965
- var import_types7 = __toESM(require_dist(), 1);
54309
+ var import_types8 = __toESM(require_dist(), 1);
53966
54310
 
53967
54311
  // src/kit-keys.ts
53968
54312
  var KIT_KEYS = Object.freeze({
@@ -54040,7 +54384,7 @@ import { join as join26, resolve as resolve5 } from "node:path";
54040
54384
 
54041
54385
  // src/init-scan.ts
54042
54386
  import { spawn as spawn6 } from "node:child_process";
54043
- var import_validation = __toESM(require_dist2(), 1);
54387
+ var import_validation2 = __toESM(require_dist2(), 1);
54044
54388
  import { createHash as createHash7 } from "node:crypto";
54045
54389
  import { constants as fsConstants4 } from "node:fs";
54046
54390
  import { lstat as lstat12, mkdir as mkdir8, open as open5, realpath as realpath15, writeFile as writeFile4 } from "node:fs/promises";
@@ -54135,7 +54479,7 @@ async function readJson(root, path) {
54135
54479
  }
54136
54480
  async function readSmall2(root, path, max) {
54137
54481
  try {
54138
- if (!(0, import_validation.evidencePathAllowed)(path)) return null;
54482
+ if (!(0, import_validation2.evidencePathAllowed)(path)) return null;
54139
54483
  const realRoot = await realpath15(root), source = join25(root, path);
54140
54484
  if (await realpath15(source) !== join25(realRoot, ...path.split("/"))) return null;
54141
54485
  const seen = await lstat12(source);
@@ -54290,7 +54634,7 @@ async function scanFacts(checkout, app) {
54290
54634
  const stack = [];
54291
54635
  const add = (category, product, major, evidence) => {
54292
54636
  if (stack.some((entry) => entry.category === category && entry.product === product) || stack.length >= 60) return;
54293
- 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] : [] });
54294
54638
  };
54295
54639
  const manifestPath = `${prefix}package.json`;
54296
54640
  const manifest = own4.includes(manifestPath) ? await readJson(checkout.root, manifestPath) : null;
@@ -54337,9 +54681,9 @@ async function scanFacts(checkout, app) {
54337
54681
  }
54338
54682
  }
54339
54683
  const stories = own4.filter((file) => /\.stories\.(?:tsx?|jsx?|mdx|vue|svelte)$/.test(file));
54340
- const configPath = own4.find((file) => /(?:^|\/)\.storybook\/main\.(?:[cm]?[jt]s)$/.test(file) && (0, import_validation.evidencePathAllowed)(file)) ?? null;
54341
- const patternConfig = own4.find((file) => /(?:^|\/)patternlab-config\.json$/.test(file) && (0, import_validation.evidencePathAllowed)(file)) ?? null;
54342
- 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));
54343
54687
  const hasPatternLabDependency = manifest !== null && Object.keys(dependencies(manifest)).some((name) => name.startsWith("@pattern-lab/"));
54344
54688
  const patternLab = patternConfig !== null || patternFiles.length > 0 || hasPatternLabDependency;
54345
54689
  const atomicLevel = (file) => file.match(/(?:^|\/)(?:\d+[-_])?(atoms|molecules|organisms|templates|pages)(?:\/|$)/)?.[1];
@@ -54356,24 +54700,24 @@ async function scanFacts(checkout, app) {
54356
54700
  return { name: name.slice(0, 120), ...parent && parent !== "." && parent !== name ? { group: parent.slice(0, 120) } : {}, path: file };
54357
54701
  }),
54358
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 }))
54359
- ].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);
54360
54704
  const designSources = {};
54361
- 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));
54362
54706
  if (tokenPath) {
54363
54707
  designSources.tokens = { path: tokenPath, evidence: [tokenPath] };
54364
54708
  add("build", "design-tokens", null, tokenPath);
54365
54709
  }
54366
- 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));
54367
54711
  if (codeConnectPath) {
54368
54712
  designSources.codeConnect = { present: true, configPath: codeConnectPath };
54369
54713
  add("ui_library", "figma-code-connect", null, codeConnectPath);
54370
54714
  }
54371
- if (rootPath && patternFiles[0] && (0, import_validation.evidencePathAllowed)(rootPath)) designSources.components = { path: rootPath, evidence: [patternFiles[0]] };
54372
- 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);
54373
54717
  for (const file of figmaSources) {
54374
54718
  const content3 = await readSmall2(checkout.root, file, INIT_SCAN_LIMITS.fileBytes);
54375
54719
  const url = content3?.match(/https:\/\/(?:www\.)?figma\.com\/(?:file|design)\/[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)?/)?.[0];
54376
- if (url && (0, import_validation.environmentUrlAllowed)(url)) {
54720
+ if (url && (0, import_validation2.environmentUrlAllowed)(url)) {
54377
54721
  designSources.figmaFile = { url, evidence: [file] };
54378
54722
  break;
54379
54723
  }
@@ -54389,7 +54733,7 @@ async function scanFacts(checkout, app) {
54389
54733
  const inputs = checkout.files.filter((file) => !ignored(file) && (file.startsWith(prefix) && stagingAllowed(file.slice(prefix.length)) || !!prefix && rootInput(file)));
54390
54734
  const environmentNames = [];
54391
54735
  const environment = (name, file) => {
54392
- 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;
54393
54737
  const known = environmentNames.find((entry) => entry.name === name);
54394
54738
  if (known) {
54395
54739
  if (!known.evidence.includes(file) && known.evidence.length < 3) known.evidence.push(file);
@@ -54432,7 +54776,7 @@ async function scanFacts(checkout, app) {
54432
54776
  }
54433
54777
  const base = {
54434
54778
  stack,
54435
- 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 },
54436
54780
  locales,
54437
54781
  ci,
54438
54782
  docker,
@@ -54440,7 +54784,7 @@ async function scanFacts(checkout, app) {
54440
54784
  ...Object.keys(designSources).length ? { designSources } : {},
54441
54785
  ...environmentNames.length ? { environmentNames } : {}
54442
54786
  };
54443
- 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");
54444
54788
  return { facts: { ...base, factsHash }, components };
54445
54789
  }
54446
54790
  var ENV_EXAMPLE = /^\.env\.(?:example|sample|template)$/;
@@ -54479,7 +54823,7 @@ function stagingAllowed(relative3) {
54479
54823
  if (segments.some((segment) => STAGING_DENY.test(segment))) return false;
54480
54824
  const name = posix3.basename(relative3);
54481
54825
  const checkedPath = ENV_EXAMPLE.test(name) ? [...segments.slice(0, -1), "env-example"].join("/") : relative3;
54482
- if (!(0, import_validation.evidencePathAllowed)(checkedPath)) return false;
54826
+ if (!(0, import_validation2.evidencePathAllowed)(checkedPath)) return false;
54483
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;
54484
54828
  return ENV_EXAMPLE.test(name) || STAGING_ALLOW.some((pattern) => pattern.test(name)) || STAGING_ALLOW_PATH.some((pattern) => pattern.test(relative3));
54485
54829
  }
@@ -54564,7 +54908,7 @@ async function stageApplication(checkout, app, dir) {
54564
54908
  }
54565
54909
  const sourceBytes = bytes.length;
54566
54910
  if (envExample) bytes = Buffer.from(environmentKeys(bytes.toString("utf8")), "utf8");
54567
- if (designInputFile(file) && (0, import_validation.credentialShapeOf)(bytes.toString("utf8"))) {
54911
+ if (designInputFile(file) && (0, import_validation2.credentialShapeOf)(bytes.toString("utf8"))) {
54568
54912
  skipped++;
54569
54913
  continue;
54570
54914
  }
@@ -55715,7 +56059,7 @@ function parseListing(result) {
55715
56059
  const seen = /* @__PURE__ */ new Set();
55716
56060
  return kits.map((raw) => {
55717
56061
  const k = raw;
55718
- 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) {
55719
56063
  throw protocol("listing");
55720
56064
  }
55721
56065
  seen.add(k.kitKey);
@@ -55945,6 +56289,9 @@ function installedOf(kit2, previous2, downgraded) {
55945
56289
  const minVersion = downgraded ? kit2.version : Math.max(previous2?.minVersion ?? kit2.version, kit2.version);
55946
56290
  return { kitKey: kit2.kitKey, kind: kit2.kind, role: kit2.role, version: kit2.version, versionId: kit2.versionId, contentHash: kit2.contentHash, placement: kit2.placement, minVersion };
55947
56291
  }
56292
+ function cleanupStatusCommand(profileKey2, projectId) {
56293
+ return `fleek --profile ${profileKey2} kit status --project ${projectId}`;
56294
+ }
55948
56295
  var tupleId = (kitKey, version2) => `${kitKey}@${version2}`;
55949
56296
  function checkoutTuples(checkouts) {
55950
56297
  const out = /* @__PURE__ */ new Map();
@@ -56255,7 +56602,7 @@ async function settleFormerProjects(ctx, profile, exclude) {
56255
56602
  return { pending, offline };
56256
56603
  }
56257
56604
  function reportFormer(ctx, settlement) {
56258
- for (const item2 of settlement?.pending ?? []) ctx.out.error(ctx.out.style.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(item2.root), reason: item2.reason })));
56605
+ for (const item2 of settlement?.pending ?? []) ctx.out.error(ctx.out.style.warn(ctx.t("kit.cleanupPendingSummary", { path: neutralizeLine(item2.root), reason: neutralizeLine(item2.reason) })));
56259
56606
  for (const projectId of settlement?.offline ?? []) ctx.out.error(ctx.out.style.warn(ctx.t("kit.formerOffline", { project: projectId })));
56260
56607
  }
56261
56608
  async function staleKeyRefusal(ctx, profile, project) {
@@ -56414,7 +56761,7 @@ async function kitPull(ctx, projectRef, values, options = {}) {
56414
56761
  for (const entry of listedMcp) ctx.out.line(s.warn(ctx.t("kit.mcpManual", { target: entry.target, entry: s.cmd(neutralizeLine(`${entry.name} ${entry.url}`)) })));
56415
56762
  for (const key of unsigned2) ctx.out.line(s.warn(ctx.t("kit.unsignedPending", { kit: key })));
56416
56763
  ctx.out.line(s.ok(summary.changed ? ctx.t("kit.pulled", { count: installed.length }) : ctx.t("kit.upToDate")));
56417
- for (const pending of skippedRoots) ctx.out.error(s.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(pending.root), reason: pending.reason })));
56764
+ for (const pending of skippedRoots) ctx.out.error(s.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(pending.root), reason: neutralizeLine(pending.reason), command: cleanupStatusCommand(profile.key, projectId) })));
56418
56765
  const runnable = targets.find((target) => KIT_CAPABILITIES[target].launcher);
56419
56766
  if (options.nextStep !== false && runnable && !skippedRoots.length && !former.pending.length) {
56420
56767
  ctx.out.line(` ${ctx.t("next.step", { command: s.cmd(`fleek kit run ${runnable}${here ? "" : ` --project ${ref}`}`) })}`);
@@ -56548,7 +56895,7 @@ async function kitStatus(ctx, values, options = {}) {
56548
56895
  for (const [target, value] of Object.entries(e1)) if (value === "both") ctx.out.line(s.warn(ctx.t("kit.doubleE1", { target })));
56549
56896
  for (const key of withdrawn.keys()) ctx.out.line(s.warn(ctx.t("kit.disabled", { kit: key })));
56550
56897
  for (const tuple of checkoutWithdrawn) ctx.out.line(s.warn(ctx.t("kit.disabled", { kit: tuple })));
56551
- for (const pending of cleanupPending) ctx.out.error(s.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(pending.root), reason: pending.reason })));
56898
+ for (const pending of cleanupPending) ctx.out.error(s.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(pending.root), reason: neutralizeLine(pending.reason), command: cleanupStatusCommand(profileHint.key, projectId) })));
56552
56899
  if (rows.some((row) => row.state === "update")) {
56553
56900
  ctx.out.line(` ${ctx.t("next.step", { command: s.cmd(`fleek kit pull${values.project ? ` ${neutralizeLine(values.project)}` : ""}`) })}`);
56554
56901
  }
@@ -56640,6 +56987,20 @@ function defaultSpawn(program, args, options) {
56640
56987
  child.once("exit", (code, signal) => done(code ?? (signal ? 128 : 1)));
56641
56988
  });
56642
56989
  }
56990
+ async function assertKitCleanup(ctx, profileKey2) {
56991
+ const pendingCleanup = [];
56992
+ for (const projectId of await localProjects(ctx.configDir, profileKey2)) {
56993
+ for (const item2 of await new KitDomain(ctx.configDir, profileKey2, projectId).cleanupPending()) pendingCleanup.push({ ...item2, projectId });
56994
+ }
56995
+ for (const item2 of pendingCleanup) ctx.out.error(ctx.out.style.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(item2.root), reason: neutralizeLine(item2.reason), command: cleanupStatusCommand(profileKey2, item2.projectId) })));
56996
+ const here = await realpath16(ctx.deps.cwd ?? process.cwd()).catch(() => null);
56997
+ const blocking = here ? pendingCleanup.find((item2) => here === item2.root || here.startsWith(item2.root + sep8)) : void 0;
56998
+ if (blocking) throw new CliError("errors.kitRunCleanupPending", KIT_EXIT.revokedOrNotEntitled, {
56999
+ path: neutralizeLine(blocking.root),
57000
+ project: blocking.projectId,
57001
+ command: cleanupStatusCommand(profileKey2, blocking.projectId)
57002
+ }, "CLEANUP_PENDING");
57003
+ }
56643
57004
  async function kitRun(ctx, client, values, userArgs) {
56644
57005
  if (!client || !KIT_TARGETS.includes(client)) throw usage2();
56645
57006
  const target = client;
@@ -56664,11 +57025,7 @@ async function kitRun(ctx, client, values, userArgs) {
56664
57025
  else ctx.info(notice);
56665
57026
  }
56666
57027
  }
56667
- const pendingCleanup = await domain.cleanupPending();
56668
- for (const item2 of pendingCleanup) ctx.out.error(ctx.out.style.warn(ctx.t("kit.cleanupPending", { path: neutralizeLine(item2.root), reason: item2.reason })));
56669
- const here = await realpath16(ctx.deps.cwd ?? process.cwd()).catch(() => null);
56670
- const blocking = here ? pendingCleanup.find((item2) => here === item2.root || here.startsWith(item2.root + sep8)) : void 0;
56671
- if (blocking) throw new CliError("errors.kitRunCleanupPending", KIT_EXIT.revokedOrNotEntitled, { path: blocking.root }, "CLEANUP_PENDING");
57028
+ await assertKitCleanup(ctx, profile.key);
56672
57029
  const gen = await domain.current();
56673
57030
  if (!gen) throw new CliError("errors.kitNotPulled", EXIT.failed, { project: projectId }, "KIT_NOT_PULLED");
56674
57031
  const state = gen.state.targets[target];
@@ -56740,7 +57097,7 @@ async function kitRun(ctx, client, values, userArgs) {
56740
57097
 
56741
57098
  // src/init.ts
56742
57099
  import { createHash as createHash8, randomUUID as randomUUID4 } from "node:crypto";
56743
- var import_validation2 = __toESM(require_dist2(), 1);
57100
+ var import_validation3 = __toESM(require_dist2(), 1);
56744
57101
  import { constants as fsConstants5 } from "node:fs";
56745
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";
56746
57103
  import { tmpdir } from "node:os";
@@ -56831,11 +57188,11 @@ function instructions2(ctx, app, facts) {
56831
57188
  "",
56832
57189
  ...projectFactLines(de, facts),
56833
57190
  de ? "## Ausgabe" : "## Output",
56834
- 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}\`:`,
56835
57192
  "",
56836
57193
  "```json",
56837
57194
  JSON.stringify({
56838
- format: import_validation2.PROJECT_INIT_AGENT_FORMAT,
57195
+ format: import_validation3.PROJECT_INIT_AGENT_FORMAT,
56839
57196
  sections: { overview: "…", architecture: "…", componentsNote: "…", cmsNote: "…", integrationsNote: "…" },
56840
57197
  components: [{ name: "Button", group: "Basis", note: "…" }],
56841
57198
  cms: null,
@@ -56848,7 +57205,7 @@ function instructions2(ctx, app, facts) {
56848
57205
  }, null, 2),
56849
57206
  "```",
56850
57207
  "",
56851
- 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.`
56852
57209
  ].join("\n");
56853
57210
  }
56854
57211
  function projectFactLines(de, facts) {
@@ -56937,7 +57294,7 @@ async function startAgent(ctx, values, stagingDir, outputFile, timeoutMs, app) {
56937
57294
  env,
56938
57295
  signal: ctx.deps.signal,
56939
57296
  timeoutMs: Math.max(1, timeoutMs),
56940
- maxBytes: import_validation2.PROJECT_INIT_LIMITS.summaryBytes
57297
+ maxBytes: import_validation3.PROJECT_INIT_LIMITS.summaryBytes
56941
57298
  }));
56942
57299
  if (result.code !== 0) throw new CliError("errors.initAgentFailed", EXIT.failed, { code: result.code }, "AGENT_FAILED");
56943
57300
  const temporary = `${outputFile}.tmp`;
@@ -57065,7 +57422,7 @@ async function initCommand(ctx, values) {
57065
57422
  if (!apps.includes(app)) apps.push(app);
57066
57423
  }
57067
57424
  } else if (tty) {
57068
- const max = import_validation2.PROJECT_INIT_LIMITS.applicationsPerRun;
57425
+ const max = import_validation3.PROJECT_INIT_LIMITS.applicationsPerRun;
57069
57426
  const defaults = candidates.filter((app) => !app.library).slice(0, max);
57070
57427
  const lines = [
57071
57428
  ctx.t("init.selectHeading", { count: candidates.length, max }),
@@ -57088,7 +57445,7 @@ async function initCommand(ctx, values) {
57088
57445
  if (picked === null) throw usage3("errors.initSelection", { max, project: values.project, app: candidates[0]?.key ?? "app" });
57089
57446
  apps = picked;
57090
57447
  } else throw usage3("errors.initYesNeedsApp");
57091
- 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 });
57092
57449
  if (!apps.length) throw usage3("errors.initNoApps");
57093
57450
  const existing = context.applications.filter((entry) => entry.name !== null && APPLICATION_KEY.test(entry.key));
57094
57451
  const mapping = await mapApplications(ctx, apps, explicit, existing, tty && !values.yes, values.verbose);
@@ -57235,20 +57592,20 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57235
57592
  const staged = await stageApplication(checkout, app, stagingDir);
57236
57593
  const applicationKey = application.key;
57237
57594
  const input = {
57238
- format: import_validation2.PROJECT_INIT_INPUT_FORMAT,
57595
+ format: import_validation3.PROJECT_INIT_INPUT_FORMAT,
57239
57596
  application: { key: applicationKey, name: application.name, path: app.path, kind: app.kind },
57240
57597
  facts,
57241
57598
  files: staged.files,
57242
57599
  base: known?.base ?? null,
57243
57600
  statements: Array.isArray(known?.statements) ? known.statements.slice(0, 100) : [],
57244
- outputFormat: import_validation2.PROJECT_INIT_AGENT_FORMAT
57601
+ outputFormat: import_validation3.PROJECT_INIT_AGENT_FORMAT
57245
57602
  };
57246
57603
  const inputFile = join29(stagingDir, "fleek-input.json"), instructionsFile = join29(stagingDir, "FLEEK-INIT.md"), outputFile = join29(outputDir, "agent-output.json");
57247
57604
  await writeFile6(inputFile, `${JSON.stringify(input, null, 2)}
57248
57605
  `, { mode: 256 });
57249
57606
  await writeFile6(instructionsFile, `${instructions2(ctx, app, facts)}
57250
57607
  `, { mode: 256 });
57251
- 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");
57252
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")}`;
57253
57610
  if (values.yes && !values["dry-run"] && (await client.availableTools()).has(ACTION_STATUS_TOOL)) {
57254
57611
  const status = await client.callTool(ACTION_STATUS_TOOL, { action: WIRE.projectInitSubmit, idempotencyKey }).then((r) => r.structured).catch(() => null);
@@ -57287,18 +57644,18 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57287
57644
  let raw;
57288
57645
  try {
57289
57646
  const seen = await lstat13(outputFile);
57290
- 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");
57291
57648
  const handle = await open6(outputFile, fsConstants5.O_RDONLY | (fsConstants5.O_NOFOLLOW ?? 0) | (fsConstants5.O_NONBLOCK ?? 0));
57292
57649
  try {
57293
57650
  const info = await handle.stat();
57294
57651
  if (!info.isFile() || info.ino !== seen.ino || info.dev !== seen.dev || info.nlink !== 1) throw new Error("replaced");
57295
- const buffer = Buffer.alloc(import_validation2.PROJECT_INIT_LIMITS.summaryBytes + 1);
57652
+ const buffer = Buffer.alloc(import_validation3.PROJECT_INIT_LIMITS.summaryBytes + 1);
57296
57653
  let length = 0;
57297
57654
  for (; ; ) {
57298
57655
  const { bytesRead } = await handle.read(buffer, length, buffer.length - length, length);
57299
57656
  if (bytesRead === 0) break;
57300
57657
  length += bytesRead;
57301
- 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");
57302
57659
  }
57303
57660
  raw = JSON.parse(buffer.subarray(0, length).toString("utf8"));
57304
57661
  } finally {
@@ -57307,33 +57664,33 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57307
57664
  } catch {
57308
57665
  raw = void 0;
57309
57666
  }
57310
- const agentOutput = raw === void 0 ? null : (0, import_validation2.parseProjectInitAgentOutput)(raw);
57667
+ const agentOutput = raw === void 0 ? null : (0, import_validation3.parseProjectInitAgentOutput)(raw);
57311
57668
  if (!agentOutput?.ok) {
57312
57669
  emit(ctx, { event: "error", app: app.key, code: "output_invalid" });
57313
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 || "-" : "-" })));
57314
57671
  return "failed";
57315
57672
  }
57316
- const composed = (0, import_validation2.composeProjectInitSummary)({
57673
+ const composed = (0, import_validation3.composeProjectInitSummary)({
57317
57674
  application: { key: applicationKey, name: application.name, path: app.path, kind: app.kind },
57318
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" },
57319
57676
  facts,
57320
57677
  components
57321
57678
  }, agentOutput.value, input.statements);
57322
- const parsed = (0, import_validation2.parseProjectInitSummary)(composed);
57679
+ const parsed = (0, import_validation3.parseProjectInitSummary)(composed);
57323
57680
  if (!parsed.ok) {
57324
57681
  emit(ctx, { event: "error", app: app.key, code: "output_invalid" });
57325
57682
  if (!ctx.json) ctx.out.error(ctx.out.style.fail(ctx.t("init.outputInvalid", { app: app.key, field: parsed.issues[0]?.path || "-" })));
57326
57683
  return "failed";
57327
57684
  }
57328
- const findings = (0, import_validation2.scanProjectInit)(parsed.value);
57329
- 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);
57330
57687
  const removed = findings.map((finding) => ({ path: finding.path, reason: finding.reason }));
57331
57688
  if (!summary) {
57332
57689
  emit(ctx, { event: "error", app: app.key, code: "application_unusable" });
57333
57690
  if (!ctx.json) ctx.out.error(ctx.out.style.fail(ctx.t("init.unusable", { app: app.key })));
57334
57691
  return "failed";
57335
57692
  }
57336
- const warnings = (0, import_validation2.projectInitWarnings)(summary).length;
57693
+ const warnings = (0, import_validation3.projectInitWarnings)(summary).length;
57337
57694
  emit(ctx, { event: "checked", app: app.key, removed, warnings });
57338
57695
  if (!ctx.json) {
57339
57696
  const s = ctx.out.style;
@@ -57385,7 +57742,7 @@ async function runApplication(ctx, client, values, checkout, context, app, appli
57385
57742
  }
57386
57743
 
57387
57744
  // src/service.ts
57388
- var import_types8 = __toESM(require_dist(), 1);
57745
+ var import_types9 = __toESM(require_dist(), 1);
57389
57746
  import { spawn as spawn8 } from "node:child_process";
57390
57747
  import { randomBytes as randomBytes11, randomUUID as randomUUID5 } from "node:crypto";
57391
57748
  import { constants as fsConstants6 } from "node:fs";
@@ -57487,7 +57844,7 @@ var TokenFilter = class {
57487
57844
  var usage4 = () => new CliError("errors.usage", EXIT.usage, {}, "USAGE");
57488
57845
  function normalizeSetupCode(value) {
57489
57846
  const code = (value ?? "").toUpperCase().replace(/[\s-]/g, "");
57490
- 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();
57491
57848
  return code;
57492
57849
  }
57493
57850
  function serverArg(value) {
@@ -58371,7 +58728,7 @@ function realSystem(options = {}) {
58371
58728
  }
58372
58729
 
58373
58730
  // src/setup.ts
58374
- var import_types9 = __toESM(require_dist(), 1);
58731
+ var import_types10 = __toESM(require_dist(), 1);
58375
58732
  import { hostname } from "node:os";
58376
58733
  import { join as join32, resolve as resolve8 } from "node:path";
58377
58734
  import { realpath as realpath19 } from "node:fs/promises";
@@ -58534,7 +58891,7 @@ function createSetupProxyAdapter(ctx) {
58534
58891
  // src/setup.ts
58535
58892
  async function setupCommand(ctx, code, values) {
58536
58893
  const normalized = (code ?? "").replace(/-/g, "").toUpperCase();
58537
- 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))) {
58538
58895
  throw new CliError("errors.setupCode", EXIT.usage, {}, "INVALID_SETUP_CODE");
58539
58896
  }
58540
58897
  registerSecret(code);
@@ -59210,7 +59567,7 @@ function derivedClientId(origin) {
59210
59567
  const url = new URL(origin);
59211
59568
  const labels = url.hostname.split(".");
59212
59569
  if (url.protocol !== "https:" || labels.length < 3) return null;
59213
- return (0, import_types10.fleekCliClientId)(`https://app.${labels.slice(1).join(".")}`);
59570
+ return (0, import_types11.fleekCliClientId)(`https://app.${labels.slice(1).join(".")}`);
59214
59571
  }
59215
59572
  function validClientId(value) {
59216
59573
  let url;
@@ -59410,7 +59767,7 @@ async function login(ctx, values, guided = false) {
59410
59767
  throw new CliError(pending.expiresAt <= ctx.now() ? "errors.setupDeviceExpired" : "errors.setupDeviceRestart", EXIT.needsLogin, {}, "EXPIRED_TOKEN");
59411
59768
  }
59412
59769
  registerSecret(pending.accessToken);
59413
- const uri = `${(0, import_types10.serviceDeviceVerificationOrigin)(info.issuer)}/device`;
59770
+ const uri = `${(0, import_types11.serviceDeviceVerificationOrigin)(info.issuer)}/device`;
59414
59771
  device = {
59415
59772
  deviceCode: pending.accessToken,
59416
59773
  userCode: saved.userCode,
@@ -59695,7 +60052,7 @@ async function work(ctx, sub, args, values) {
59695
60052
  WIRE.claim,
59696
60053
  {
59697
60054
  issueId: id,
59698
- purpose: oneOf2(values.purpose, import_types10.CLAIM_PURPOSES) ?? "work",
60055
+ purpose: oneOf2(values.purpose, import_types11.CLAIM_PURPOSES) ?? "work",
59699
60056
  ...values.ttl ? { ttlMinutes: int(values.ttl, 1, 1440) } : {},
59700
60057
  ...values.note ? { note: text5(values.note, 280) } : {}
59701
60058
  },
@@ -59714,7 +60071,7 @@ async function work(ctx, sub, args, values) {
59714
60071
  );
59715
60072
  case "release":
59716
60073
  case "complete": {
59717
- 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);
59718
60075
  return write(
59719
60076
  ctx,
59720
60077
  client,
@@ -60486,12 +60843,10 @@ async function kitAuto(ctx, values, client, passthrough) {
60486
60843
  return await kitRun({ ...kitCtx, deps: { ...ctx.deps, spawn: spawnWith } }, client, { ...values, project: found.projectId, orcaLaunch: true, program }, passthrough);
60487
60844
  } catch (error) {
60488
60845
  if (!(error instanceof CliError) || !["NEEDS_LOGIN", "TRANSIENT", "KIT_PROXY_UNAVAILABLE", "RATE_LIMITED", "UNAVAILABLE_ON_SERVER"].includes(error.code ?? "")) throw error;
60489
- const here = await realpath20(cwd), pending = domain ? await domain.cleanupPending() : [];
60490
- const blocking = pending.find((item2) => here === item2.root || here.startsWith(item2.root + sep10));
60491
- if (blocking) throw new CliError("errors.kitRunCleanupPending", KIT_EXIT.revokedOrNotEntitled, { path: blocking.root }, "CLEANUP_PENDING");
60846
+ await assertKitCleanup(kitCtx, found.profile.key);
60492
60847
  ctx.out.error(ctx.s.warn(ctx.t(values["dry-run"] ? "kit.autoDryRunFallback" : "kit.autoFallback", { code: error instanceof CliError ? error.code ?? error.key : "INTERNAL" })));
60493
60848
  }
60494
- }
60849
+ } else if (found) await assertKitCleanup(kitContext(ctx, values, found), found.profile.key);
60495
60850
  if (values["dry-run"]) {
60496
60851
  ctx.out.json({ program, args: passthrough, attached: false });
60497
60852
  return EXIT.ok;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logic-joe/fleek",
3
- "version": "0.2.10",
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",