halfcycle 0.3.25 → 0.3.27

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.
@@ -108,10 +108,13 @@ export interface SignInDeps {
108
108
  * DEFAULTS TO THE INSTALL'S OWN REASON, because every caller of `signIn` was the
109
109
  * installer until T-11 (`ci-oidc-token-exchange`) — an install always creates or
110
110
  * joins an engagement immediately after obtaining a credential, so the hardcoded
111
- * text was never false. `ci bind`/`ci unbind` create no engagement at all, and are
112
- * the first callers for which the default would be — supplied here rather than a
113
- * second hardcoded sentence in this file, which is how a caller's reason and this
114
- * module's default come to disagree the next time either one changes.
111
+ * text was never false. `ci bind`/`ci unbind` created no engagement at all and
112
+ * were the first callers to supply their own reason here rather than take the
113
+ * default — they were removed at T-25, but the field they motivated stays: every
114
+ * verb that does not create an engagement (`open-phase`, `close-phase`) supplies
115
+ * its own reason the same way, rather than a second hardcoded sentence in this
116
+ * file, which is how a caller's reason and this module's default come to
117
+ * disagree the next time either one changes.
115
118
  */
116
119
  reason?: string;
117
120
  }
@@ -1 +1 @@
1
- {"version":3,"file":"device-signin.d.ts","sourceRoot":"","sources":["../src/device-signin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAIH,OAAO,EAKL,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAG3B;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,KAAK;aAEpB,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM;CAKlB;AAED,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,QAGV,CAAC;AAE3B;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,QAGsC,CAAC;AAQnF,yEAAy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wBAAwB,QAIF,CAAC;AAiEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAsB,MAAM,CAC1B,UAAU,EAAE,MAAM,EAClB,IAAI,GAAE,UAAU,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CAAO,GAClD,OAAO,CAAC,QAAQ,CAAC,CAmFnB"}
@@ -107,7 +107,44 @@ export { ENGAGEMENT_ENV_HEADER, ENGAGEMENTS_DIR_NAME, ENGAGEMENT_ENV_FILENAME, H
107
107
  * than left to match by eye.
108
108
  */
109
109
  export declare const PIN_ENGAGEMENT_ID_FIELD = "engagementId";
110
- /** `~/.halfcycle/engagements/<id>/` — this engagement's machine-level state dir. */
110
+ /**
111
+ * The refusal an engagement id that is not UUID-shaped meets before it becomes a
112
+ * path. A class of its own so a caller can tell "this id cannot name a folder"
113
+ * from an I/O failure without matching on words.
114
+ */
115
+ export declare class InvalidEngagementIdError extends Error {
116
+ constructor(engagementId: string);
117
+ }
118
+ /**
119
+ * THE ENGAGEMENT-ID CHECK THIS PACKAGE CALLS — once, before an id becomes a path
120
+ * under the repository or under `~/.halfcycle` (T-18a, #1270).
121
+ *
122
+ * The id is joined into `~/.halfcycle/engagements/<id>/`, and it arrives from a
123
+ * COMMITTED file: `.halfcycle/bundle.json` travels with the repository, so anyone
124
+ * who can land a commit decides it. `"../../.ssh"` there made the installer's
125
+ * credential write, the phase stamp and the marker land wherever that pointed.
126
+ * So the id is checked here, before anything is composed from it, and a caller
127
+ * that must refuse before its FIRST write (the installer, the uninstaller) calls
128
+ * this at its entry rather than waiting for the path composition below to throw.
129
+ *
130
+ * The shape itself is not defined here: `isEngagementId` in `@halfcycle/core` is
131
+ * its one home, shared with the runner's credential refresh and rendered into the
132
+ * generated shell scripts from the same pattern (`engagementResolutionShell`). A
133
+ * second copy of the regex in this package would be a second answer to the same
134
+ * question.
135
+ *
136
+ * @throws InvalidEngagementIdError
137
+ */
138
+ export declare function assertEngagementId(engagementId: string): void;
139
+ /**
140
+ * `~/.halfcycle/engagements/<id>/` — this engagement's machine-level state dir.
141
+ *
142
+ * Every path this package composes under `~/.halfcycle/engagements` passes through
143
+ * here, so the id is checked HERE as well as at the callers' entries: a caller
144
+ * that forgot `assertEngagementId` still cannot compose a path out of `../`.
145
+ *
146
+ * @throws InvalidEngagementIdError
147
+ */
111
148
  export declare function engagementStateDir(engagementId: string, home?: string): string;
112
149
  /** `~/.halfcycle/engagements/<id>/env` — the owner-only per-engagement env file. */
113
150
  export declare function engagementEnvPath(engagementId: string, home?: string): string;
@@ -340,9 +377,18 @@ export declare function writeEngagementEnv(engagementId: string, values: Record<
340
377
  * `HALFCYCLE_ENV_FILE` / `HALFCYCLE_ENV_PROBLEM` / `HALFCYCLE_ENV_ENGAGEMENT` in
341
378
  * the CURRENT shell and returns a status, and callers use `if halfcycle_env_file …`.
342
379
  *
343
- * `$HALFCYCLE_ENV_PROBLEM` names which step failed — `no-pin`, `no-id`, `no-home`,
344
- * `no-credential` — so each caller says the true thing for its own surface instead
345
- * of printing one sentence for four different situations.
380
+ * `$HALFCYCLE_ENV_PROBLEM` names which step failed — `no-pin`, `no-id`, `bad-id`,
381
+ * `no-home`, `no-credential` — so each caller says the true thing for its own
382
+ * surface instead of printing one sentence for five different situations.
383
+ *
384
+ * **`bad-id` (T-18a, #1270) is the id failing `ENGAGEMENT_ID_PATTERN`** — core's
385
+ * one definition of the shape, interpolated here so the shell and
386
+ * `isEngagementId` cannot disagree about what may become a path. It is a problem
387
+ * value of its own rather than `no-id` because the remedy differs: re-running the
388
+ * installer does not rewrite a pin whose id it refuses, so "run npx halfcycle to
389
+ * rewrite it" would be false. The guard wrapper and the session-start marker treat
390
+ * every failure alike (no credential sourced), which is the right answer for this
391
+ * one too; only `mcp-headers.sh` words each case, and it has a `bad-id` arm.
346
392
  *
347
393
  * **HALFCYCLE_ENV_NOT_THIS_ACCOUNT IS SET ON THE `no-credential` FAILURE PATH TOO
348
394
  * (T-02b, `solo-project-ownership`) — that is the state it exists to distinguish.**
@@ -1 +1 @@
1
- {"version":3,"file":"engagement-credential.d.ts","sourceRoot":"","sources":["../src/engagement-credential.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AAiBH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,gCAAgC,EAChC,YAAY,EACZ,GAAG,EACH,OAAO,GACR,MAAM,iBAAiB,CAAC;AAgBzB;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAMnF;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,cAAc,8EAIjB,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,4BAA4B,mDAExC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,mBAAmB,mMAOtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,O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