@tomflow/chatloop-context 0.1.2 → 0.1.4
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/README.md +22 -10
- package/lib/context-protocol.mjs +15 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -75,10 +75,12 @@ command for already approved automated setup; it does **not** itself collect
|
|
|
75
75
|
a real user-review prompt and must not be offered as the normal first-use flow.
|
|
76
76
|
None of these commands are exposed as ordinary model Context MCP mutations.
|
|
77
77
|
A local TTY/OS-UID operator approval is not cryptographic ChatGPT user
|
|
78
|
-
authentication.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
authentication. Without explicit user authorization, do not infer independent
|
|
79
|
+
approval or claim a completed in-Chat self-service onboarding. For a user-
|
|
80
|
+
delegated Agent migration, label the operator `USER_DELEGATED_AGENT` and retain
|
|
81
|
+
the exact verified source/backup/revision evidence; never describe this as an
|
|
82
|
+
independent human or platform-authenticated approval. None of these operations
|
|
83
|
+
grant Chrome Owner or migrate an existing Legacy Store by themselves.
|
|
82
84
|
|
|
83
85
|
## Offline shared Store extraction (diagnostic ONLY, not a cutover)
|
|
84
86
|
|
|
@@ -121,9 +123,14 @@ For an uncertain result, **query** with the same ID, never resubmit with a new I
|
|
|
121
123
|
chatloop-context project reconcile-receipt demo /private/old/shared.sqlite \
|
|
122
124
|
<epoch> <writeRequestId>
|
|
123
125
|
|
|
124
|
-
This interface is a local-operator
|
|
125
|
-
proof of
|
|
126
|
-
|
|
126
|
+
This interface is a local-operator entry; a TTY under one OS UID is not
|
|
127
|
+
proof of platform-authenticated ChatGPT user approval. By default an autonomous
|
|
128
|
+
agent MUST NOT infer an independent operator decision. When the user expressly
|
|
129
|
+
delegates the precise migration scope in the current conversation, the agent
|
|
130
|
+
may operate the existing TTY path as a **disclosed user-delegated local agent**,
|
|
131
|
+
with exact SourceUnit/hash/revision checks and an immutable private delegation
|
|
132
|
+
audit record. Record `USER_DELEGATED_AGENT`, never `INDEPENDENT_HUMAN` or
|
|
133
|
+
platform-authenticated consent. This delegation does not approve R/P or Owner.
|
|
127
134
|
The audit reads source bytes and Registry-linked Task documents, checks exact
|
|
128
135
|
Project Material hash/path coverage, and distinguishes a changed Registry
|
|
129
136
|
file from drift in a linked task document. Its CLI receipt also includes
|
|
@@ -236,9 +243,14 @@ If publication fails after sealing, preserve the sealed source, existing
|
|
|
236
243
|
private backup and seal receipt for offline recovery; never copy/rename a
|
|
237
244
|
`DIAGNOSTIC_ONLY` Store into production or flip `storeMode` directly.
|
|
238
245
|
The CLI rejects non-TTY callers and the module is not exposed via ordinary
|
|
239
|
-
MCP. Same-UID local
|
|
240
|
-
independent ChatGPT user authorization.
|
|
241
|
-
|
|
246
|
+
MCP. Same-UID local terminal confirmation alone is **not** proof of an
|
|
247
|
+
independent ChatGPT user authorization. Exception: a current explicit user
|
|
248
|
+
instruction can delegate a specific Project cutover to an Agent, which may
|
|
249
|
+
operate the local TTY as `USER_DELEGATED_AGENT` after recording the source
|
|
250
|
+
identities, hashes, revisions, physical writer fence, backup and restoration
|
|
251
|
+
evidence. The resulting review is delegated, **not independently human-verified**.
|
|
252
|
+
Do not weaken the actual Core CAS, offline backup, old-writer check, Legacy
|
|
253
|
+
fence, R/P approval, UNKNOWN-send or browser Owner guards.
|
|
242
254
|
|
|
243
255
|
**Production remains BLOCKED** until the physical source hashes, mixed
|
|
244
256
|
CURRENT ownership, old writers and true operator approval have been reviewed,
|
package/lib/context-protocol.mjs
CHANGED
|
@@ -385,8 +385,10 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
|
|
|
385
385
|
checkIds(projectId,taskId);readAuth(projectId,taskId,'run.terminalStatus');
|
|
386
386
|
const r=required(projectId,taskId),c=parse(r.context_json);
|
|
387
387
|
return {projectId,taskId,taskRevision:r.business_revision,
|
|
388
|
-
bindingRevision:r.binding_revision,
|
|
389
|
-
|
|
388
|
+
bindingRevision:r.binding_revision,approvalRevision:r.approval_revision,
|
|
389
|
+
unknownEffectCount:unresolvedEffects(c).length,
|
|
390
|
+
runRef:r.writable_ref,executionOutcome:c.executionOutcome??null,
|
|
391
|
+
deliveryRef:c.deliveryRef??null};
|
|
390
392
|
},
|
|
391
393
|
latestCheckpoint(projectId,taskId){
|
|
392
394
|
checkIds(projectId,taskId);readAuth(projectId,taskId,'context.latestCheckpoint');
|
|
@@ -1068,11 +1070,17 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
|
|
|
1068
1070
|
documentCreate(a){
|
|
1069
1071
|
return receipt(a,'document.createDraft',()=>{
|
|
1070
1072
|
const r=scope(a);expectedBusiness(r,a.expectedTaskRevision);
|
|
1071
|
-
|
|
1073
|
+
// The public Method Catalog also advertises immutable task-scoped
|
|
1074
|
+
// reference and historical-evidence drafts. They are storage only:
|
|
1075
|
+
// document.prepareIssue must never turn them into R/P approval issues.
|
|
1076
|
+
assert(['R','P','INSTRUCTIONS','HISTORY','LEGACY_EVIDENCE','REFERENCE']
|
|
1077
|
+
.includes(a.kind),'INVALID_DOCUMENT_KIND');
|
|
1072
1078
|
assert(ID.test(a.documentId||'')&&Number.isInteger(a.version)&&a.version>=1,
|
|
1073
1079
|
'INVALID_DOCUMENT_REF');
|
|
1074
|
-
assert(typeof a.body==='string'&&a.body
|
|
1075
|
-
'INVALID_DOCUMENT_BODY');
|
|
1080
|
+
assert(typeof a.body==='string'&&Buffer.byteLength(a.body,'utf8')>=1
|
|
1081
|
+
&&Buffer.byteLength(a.body,'utf8')<=4*1024*1024,'INVALID_DOCUMENT_BODY');
|
|
1082
|
+
if(a.kind!=='P')assert(a.requirementRef===undefined,
|
|
1083
|
+
'REQUIREMENT_REF_FOR_NON_PLAN');
|
|
1076
1084
|
if(a.kind==='P'){
|
|
1077
1085
|
assert(a.requirementRef&&typeof a.requirementRef==='object','REQUIREMENT_REF_REQUIRED');
|
|
1078
1086
|
const req=db.prepare("SELECT content_hash FROM documents WHERE project_id=? AND task_id=? AND document_id=? AND version=? AND kind='R'")
|
|
@@ -1129,6 +1137,7 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
|
|
|
1129
1137
|
const doc=db.prepare('SELECT * FROM documents WHERE project_id=? AND task_id=? AND document_id=? AND version=?')
|
|
1130
1138
|
.get(a.projectId,a.taskId,a.documentId,a.version);
|
|
1131
1139
|
assert(doc&&doc.content_hash===a.contentHash,'DOCUMENT_VERSION_MISMATCH');
|
|
1140
|
+
assert(['R','P'].includes(doc.kind),'ISSUE_DOCUMENT_KIND_INVALID');
|
|
1132
1141
|
const approvals=parse(r.approval_json);
|
|
1133
1142
|
// Publishing a NEW version invalidates the affected previous approval.
|
|
1134
1143
|
// A draft alone never revokes it. A cancelled issue will not revive it.
|
|
@@ -1156,6 +1165,7 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
|
|
|
1156
1165
|
const doc=db.prepare('SELECT kind,content_hash,requirement_ref FROM documents WHERE project_id=? AND task_id=? AND document_id=? AND version=?')
|
|
1157
1166
|
.get(a.projectId,a.taskId,issue.document_id,issue.version);
|
|
1158
1167
|
assert(doc&&doc.content_hash===issue.content_hash,'DOCUMENT_CHANGED');
|
|
1168
|
+
assert(['R','P'].includes(doc.kind),'ISSUE_DOCUMENT_KIND_INVALID');
|
|
1159
1169
|
if(a.decision!=='APPROVE'){
|
|
1160
1170
|
// The legacy CUSTOM decision has the same meaning as a change request.
|
|
1161
1171
|
const issueStatus=a.decision==='REJECT'?'REJECTED':'CHANGE_REQUESTED';
|