@authorbot/domain 0.1.38 → 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/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/overrides.d.ts +13 -0
- package/dist/overrides.js +16 -0
- package/package.json +2 -2
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";
|
package/dist/overrides.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
43
|
+
"@authorbot/schemas": "0.1.39"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^22.0.0",
|