@tomflow/chatloop-context 0.1.2 → 0.1.3

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 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. Until an independently verified ChatGPT→operator approval
79
- channel exists, do not claim a completed in-Chat self-service onboarding or
80
- promote this local workflow into production authorization. None of these
81
- operations grant Chrome Owner or migrate an existing Legacy Store.
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 candidate; a TTY under one OS UID is not
125
- proof of a platform-authenticated ChatGPT user approval, so it MUST NOT be used
126
- by an autonomous agent to authorize production cutover.
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 operator confirmation alone is **not** proof of an
240
- independent ChatGPT user authorization. This route must not be executed by an
241
- autonomous Agent against production Context.
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,
@@ -1068,11 +1068,17 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
1068
1068
  documentCreate(a){
1069
1069
  return receipt(a,'document.createDraft',()=>{
1070
1070
  const r=scope(a);expectedBusiness(r,a.expectedTaskRevision);
1071
- assert(['R','P'].includes(a.kind),'INVALID_DOCUMENT_KIND');
1071
+ // The public Method Catalog also advertises immutable task-scoped
1072
+ // reference and historical-evidence drafts. They are storage only:
1073
+ // document.prepareIssue must never turn them into R/P approval issues.
1074
+ assert(['R','P','INSTRUCTIONS','HISTORY','LEGACY_EVIDENCE','REFERENCE']
1075
+ .includes(a.kind),'INVALID_DOCUMENT_KIND');
1072
1076
  assert(ID.test(a.documentId||'')&&Number.isInteger(a.version)&&a.version>=1,
1073
1077
  'INVALID_DOCUMENT_REF');
1074
- assert(typeof a.body==='string'&&a.body.length>=1&&a.body.length<=1024*1024,
1075
- 'INVALID_DOCUMENT_BODY');
1078
+ assert(typeof a.body==='string'&&Buffer.byteLength(a.body,'utf8')>=1
1079
+ &&Buffer.byteLength(a.body,'utf8')<=4*1024*1024,'INVALID_DOCUMENT_BODY');
1080
+ if(a.kind!=='P')assert(a.requirementRef===undefined,
1081
+ 'REQUIREMENT_REF_FOR_NON_PLAN');
1076
1082
  if(a.kind==='P'){
1077
1083
  assert(a.requirementRef&&typeof a.requirementRef==='object','REQUIREMENT_REF_REQUIRED');
1078
1084
  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 +1135,7 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
1129
1135
  const doc=db.prepare('SELECT * FROM documents WHERE project_id=? AND task_id=? AND document_id=? AND version=?')
1130
1136
  .get(a.projectId,a.taskId,a.documentId,a.version);
1131
1137
  assert(doc&&doc.content_hash===a.contentHash,'DOCUMENT_VERSION_MISMATCH');
1138
+ assert(['R','P'].includes(doc.kind),'ISSUE_DOCUMENT_KIND_INVALID');
1132
1139
  const approvals=parse(r.approval_json);
1133
1140
  // Publishing a NEW version invalidates the affected previous approval.
1134
1141
  // A draft alone never revokes it. A cancelled issue will not revive it.
@@ -1156,6 +1163,7 @@ export function openContextProtocol(file,{authorizeInternal=()=>false,authorizeD
1156
1163
  const doc=db.prepare('SELECT kind,content_hash,requirement_ref FROM documents WHERE project_id=? AND task_id=? AND document_id=? AND version=?')
1157
1164
  .get(a.projectId,a.taskId,issue.document_id,issue.version);
1158
1165
  assert(doc&&doc.content_hash===issue.content_hash,'DOCUMENT_CHANGED');
1166
+ assert(['R','P'].includes(doc.kind),'ISSUE_DOCUMENT_KIND_INVALID');
1159
1167
  if(a.decision!=='APPROVE'){
1160
1168
  // The legacy CUSTOM decision has the same meaning as a change request.
1161
1169
  const issueStatus=a.decision==='REJECT'?'REJECTED':'CHANGE_REQUESTED';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomflow/chatloop-context",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Independent local Context SDK and short-lived CLI for Chat Loop projects",
6
6
  "publishConfig": {"access": "public"},