@authorbot/domain 0.1.37 → 0.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,33 @@ Every published package shares this version. A tag builds, tests, and publishes
9
9
  all of them together, so `@authorbot/cli@0.1.15` and `@authorbot/api@0.1.15` are
10
10
  always the same commit.
11
11
 
12
+ ## 0.1.38
13
+
14
+ - **Authorbot now has a complete local authoring mode.** `authorbot dev` runs
15
+ the real API and browser UI against a managed branch and persistent Git
16
+ worktree, with private SQLite state outside the book repository. It needs no
17
+ Cloudflare account or GitHub connection, and needs no network after the
18
+ packages are installed. Companion commands report status, print the private
19
+ starter agent environment, reset operational state without touching Git,
20
+ open a draft book pull request, and remove only worktrees Git can prove are
21
+ safe to clean up.
22
+ - **Local editing follows the repository instead of fighting it.** API reads
23
+ are pinned to committed `HEAD`, while the preview can show direct editor
24
+ saves immediately. API writes pause while the worktree is dirty or on the
25
+ wrong branch, and resume after an explicit forward-moving author commit.
26
+ Local maintainer sign-in uses a one-use bootstrap link, book-specific
27
+ cookies, a stable `local:` identity, and a private full-editor starter token.
28
+ - **The local browser loop is fast enough for Authorbot development.**
29
+ Astro/Vite serves the only browser origin and proxies the private loopback
30
+ API. Book and UI changes reload without throwing away SQLite or tokens, the
31
+ local toolbar reports branch and projection state, and a pending reload
32
+ waits when a form or editor has unsaved input. Backend source edits still
33
+ require restarting `authorbot dev`.
34
+ - Local authoring uses Node's built-in SQLite instead of a native module.
35
+ Authorbot's CLI and local runtime now require Node 22.13 or newer. Cloudflare
36
+ remains the hosted production runtime. This release has no book-format
37
+ migration and no new D1 migration.
38
+
12
39
  ## 0.1.37
13
40
 
14
41
  - **Cloudflare D1 can now apply the Phase 3B capability backfill.** The 0.1.36
package/dist/index.d.ts CHANGED
@@ -18,8 +18,8 @@ export { DECISION_RESULTS, DECISION_SUPPORT_CHANGED_EVENT, decisionResultSchema,
18
18
  export type { DecisionResult, SupportChangeOutcome, SupportChangeTransition, } from "./decision-support.js";
19
19
  export { PHASE3_WORK_ITEM_STATUSES, WORK_ITEM_STATUSES, WORK_ITEM_TRANSITIONS, canTransitionWorkItem, isPhase3WorkItemStatus, transitionWorkItem, } from "./work-item-state.js";
20
20
  export type { WorkItemStatus, WorkItemTransitionDenialReason, } from "./work-item-state.js";
21
- export { FORCE_CREATE_RULE_VERSION, MAX_OVERRIDE_REASON_LENGTH, MIN_OVERRIDE_REASON_LENGTH, authorizeCancelWorkItem, authorizeForceCreateWorkItem, authorizeRejectSuggestion, authorizeReopenSuggestion, cancelWorkItemCommandSchema, forceCreateWorkItemCommandSchema, overrideReasonSchema, rejectSuggestionCommandSchema, reopenSuggestionCommandSchema, } from "./overrides.js";
22
- export type { AnnotationPromotionDenialReason, CancelWorkItemCommand, ForceCreateWorkItemCommand, RejectSuggestionCommand, ReopenSuggestionCommand, SuggestionOverrideDenialReason, WorkItemOverrideDenialReason, } from "./overrides.js";
21
+ export { FORCE_CREATE_RULE_VERSION, MAX_OVERRIDE_REASON_LENGTH, MIN_OVERRIDE_REASON_LENGTH, authorizeCancelWorkItem, authorizeForceCreateReplyWorkItem, authorizeForceCreateWorkItem, authorizeRejectSuggestion, authorizeReopenSuggestion, cancelWorkItemCommandSchema, forceCreateReplyWorkItemCommandSchema, forceCreateWorkItemCommandSchema, overrideReasonSchema, rejectSuggestionCommandSchema, reopenSuggestionCommandSchema, } from "./overrides.js";
22
+ export type { AnnotationPromotionDenialReason, CancelWorkItemCommand, ForceCreateWorkItemCommand, ForceCreateReplyWorkItemCommand, RejectSuggestionCommand, ReopenSuggestionCommand, ReplyPromotionDenialReason, SuggestionOverrideDenialReason, WorkItemOverrideDenialReason, } from "./overrides.js";
23
23
  export { AGENT_TOKEN_PREFIX, AGENT_TOKEN_REGEX, AGENT_TOKEN_SECRET_LENGTH, DEFAULT_TOKEN_TTL_DAYS, LAST_USED_UPDATE_INTERVAL_MS, MAX_TOKEN_TTL_DAYS, SESSION_ID_LENGTH, SESSION_ID_REGEX, SESSION_TTL_DAYS, agentTokenSchema, checkTokenActive, isAgentTokenFormat, isSessionIdFormat, parseAgentToken, resolveSessionExpiry, resolveTokenExpiry, sessionIdSchema, shouldUpdateLastUsed, toTimestamp, } from "./token.js";
24
24
  export type { AgentTokenParseFailure, AgentTokenParseResult, TokenExpiryResult, TokenInactiveReason, } from "./token.js";
25
25
  export { DEFAULT_LEASE_CONFIG, LEASE_DURATION_MS, LEASE_MAX_TOTAL_DURATION_MS, LEASE_RENEWAL_DURATION_MS, LEASE_RENEWAL_PROMPT_BEFORE_MS, checkLeaseActive, checkLeaseRenewable, checkWorkItemClaimable, isLeaseExpired, leaseConfigSchema, parseIsoDuration, renewalPromptAt, resolveLeaseExpiry, shouldExpireLease, } from "./lease.js";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ export { MAX_BODY_BYTES, MAX_TOKEN_NAME_LENGTH, bodySchema, normalizeBody, creat
8
8
  export { VOTE_VALUES, authorizeVote, castVoteCommandSchema, clearVoteCommandSchema, voteValueSchema, } from "./vote.js";
9
9
  export { DECISION_RESULTS, DECISION_SUPPORT_CHANGED_EVENT, decisionResultSchema, resolveSupportChange, } from "./decision-support.js";
10
10
  export { PHASE3_WORK_ITEM_STATUSES, WORK_ITEM_STATUSES, WORK_ITEM_TRANSITIONS, canTransitionWorkItem, isPhase3WorkItemStatus, transitionWorkItem, } from "./work-item-state.js";
11
- export { FORCE_CREATE_RULE_VERSION, MAX_OVERRIDE_REASON_LENGTH, MIN_OVERRIDE_REASON_LENGTH, authorizeCancelWorkItem, authorizeForceCreateWorkItem, authorizeRejectSuggestion, authorizeReopenSuggestion, cancelWorkItemCommandSchema, forceCreateWorkItemCommandSchema, overrideReasonSchema, rejectSuggestionCommandSchema, reopenSuggestionCommandSchema, } from "./overrides.js";
11
+ export { FORCE_CREATE_RULE_VERSION, MAX_OVERRIDE_REASON_LENGTH, MIN_OVERRIDE_REASON_LENGTH, authorizeCancelWorkItem, authorizeForceCreateReplyWorkItem, authorizeForceCreateWorkItem, authorizeRejectSuggestion, authorizeReopenSuggestion, cancelWorkItemCommandSchema, forceCreateReplyWorkItemCommandSchema, forceCreateWorkItemCommandSchema, overrideReasonSchema, rejectSuggestionCommandSchema, reopenSuggestionCommandSchema, } from "./overrides.js";
12
12
  export { AGENT_TOKEN_PREFIX, AGENT_TOKEN_REGEX, AGENT_TOKEN_SECRET_LENGTH, DEFAULT_TOKEN_TTL_DAYS, LAST_USED_UPDATE_INTERVAL_MS, MAX_TOKEN_TTL_DAYS, SESSION_ID_LENGTH, SESSION_ID_REGEX, SESSION_TTL_DAYS, agentTokenSchema, checkTokenActive, isAgentTokenFormat, isSessionIdFormat, parseAgentToken, resolveSessionExpiry, resolveTokenExpiry, sessionIdSchema, shouldUpdateLastUsed, toTimestamp, } from "./token.js";
13
13
  export { DEFAULT_LEASE_CONFIG, LEASE_DURATION_MS, LEASE_MAX_TOTAL_DURATION_MS, LEASE_RENEWAL_DURATION_MS, LEASE_RENEWAL_PROMPT_BEFORE_MS, checkLeaseActive, checkLeaseRenewable, checkWorkItemClaimable, isLeaseExpired, leaseConfigSchema, parseIsoDuration, renewalPromptAt, resolveLeaseExpiry, shouldExpireLease, } from "./lease.js";
14
14
  export { LEASE_TOKEN_PREFIX, LEASE_TOKEN_REGEX, LEASE_TOKEN_SECRET_LENGTH, isLeaseTokenFormat, leaseTokenSchema, parseLeaseToken, } from "./lease-token.js";
@@ -45,8 +45,16 @@ export declare const forceCreateWorkItemCommandSchema: z.ZodObject<{
45
45
  reason: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
46
46
  }, z.core.$strict>;
47
47
  export type ForceCreateWorkItemCommand = z.infer<typeof forceCreateWorkItemCommandSchema>;
48
+ /** Force-create Work from one reply without promoting its whole annotation. */
49
+ export declare const forceCreateReplyWorkItemCommandSchema: z.ZodObject<{
50
+ annotationId: z.ZodString;
51
+ replyId: z.ZodString;
52
+ reason: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>>;
53
+ }, z.core.$strict>;
54
+ export type ForceCreateReplyWorkItemCommand = z.infer<typeof forceCreateReplyWorkItemCommandSchema>;
48
55
  export type SuggestionOverrideDenialReason = "not-maintainer" | "not-a-suggestion" | "illegal-transition";
49
56
  export type AnnotationPromotionDenialReason = "not-maintainer" | "illegal-transition";
57
+ export type ReplyPromotionDenialReason = "not-maintainer" | "illegal-transition";
50
58
  /** Reject an open suggestion (`open -> rejected`). */
51
59
  export declare function authorizeRejectSuggestion(input: {
52
60
  actorRole: Role;
@@ -76,4 +84,9 @@ export declare function authorizeForceCreateWorkItem(input: {
76
84
  annotationKind: AnnotationKind;
77
85
  annotationStatus: AnnotationStatus;
78
86
  }): Decision<AnnotationPromotionDenialReason>;
87
+ /** Promote one committed, open reply without changing the parent annotation. */
88
+ export declare function authorizeForceCreateReplyWorkItem(input: {
89
+ actorRole: Role;
90
+ replyStatus: "pending_git" | "open" | "withdrawn";
91
+ }): Decision<ReplyPromotionDenialReason>;
79
92
  //# sourceMappingURL=overrides.d.ts.map
package/dist/overrides.js CHANGED
@@ -46,6 +46,12 @@ export const forceCreateWorkItemCommandSchema = z.strictObject({
46
46
  annotationId: uuidv7Schema,
47
47
  reason: overrideReasonSchema.optional(),
48
48
  });
49
+ /** Force-create Work from one reply without promoting its whole annotation. */
50
+ export const forceCreateReplyWorkItemCommandSchema = z.strictObject({
51
+ annotationId: uuidv7Schema,
52
+ replyId: uuidv7Schema,
53
+ reason: overrideReasonSchema.optional(),
54
+ });
49
55
  function requireMaintainer(actorRole) {
50
56
  if (actorRole !== "maintainer") {
51
57
  return denied("not-maintainer", "only a maintainer may perform overrides");
@@ -106,4 +112,14 @@ export function authorizeForceCreateWorkItem(input) {
106
112
  }
107
113
  return ALLOWED;
108
114
  }
115
+ /** Promote one committed, open reply without changing the parent annotation. */
116
+ export function authorizeForceCreateReplyWorkItem(input) {
117
+ const maintainer = requireMaintainer(input.actorRole);
118
+ if (!maintainer.allowed)
119
+ return maintainer;
120
+ if (input.replyStatus !== "open") {
121
+ return denied("illegal-transition", `a reply with status "${input.replyStatus}" cannot receive a work item (only "open")`);
122
+ }
123
+ return ALLOWED;
124
+ }
109
125
  //# sourceMappingURL=overrides.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authorbot/domain",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "Pure domain logic for Authorbot: role/scope authorization, annotation and Git-operation state machines, command validators, and token/session value rules (Phase 2 contract section 3)",
5
5
  "keywords": [
6
6
  "authorbot",
@@ -40,7 +40,7 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "zod": "^4.0.0",
43
- "@authorbot/schemas": "0.1.37"
43
+ "@authorbot/schemas": "0.1.39"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^22.0.0",