@c4a/context-cli 0.7.29 → 0.7.30

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.
@@ -13,14 +13,16 @@ Before capture:
13
13
 
14
14
  1. every registered document module must have a matching capture declaration;
15
15
  2. the user must have allowed the external read in the current conversation;
16
- 3. execute only the current route command.
16
+ 3. perform the Agent's task-wide image acquisition preflight below before capture;
17
+ 4. execute only the current route command.
17
18
 
18
19
  An explicit request to capture, ingest, fetch, or read named file/remote
19
20
  documents grants source-read permission for those named modules. A mention,
20
21
  possible-source discussion, or register-only request does not. An explicit
21
22
  refusal always wins.
22
23
 
23
- When that permission is already present in the conversation, execute the
24
+ When that permission is already present and the Agent's image acquisition
25
+ preflight is complete, execute the
24
26
  Gate's returned authority-carrying command. In managed mode it runs the
25
27
  deterministic capture batch until the next real blocker; in ordinary mode it
26
28
  reevaluates status with `context.source-read`. The authority remains in the
@@ -48,12 +50,26 @@ boundary is a documentation site rather than plain Markdown, use the
48
50
  Context-provided processor/configuration diagnostic; do not invent rendered
49
51
  text or scan outside the confirmed boundary.
50
52
 
51
- For Lark reads, Context prefers the authenticated user identity. If that
52
- identity is unavailable because its credential is missing, expired, or cannot
53
- be refreshed, Context may retry the same registered source with the bot
54
- identity. It does not switch identity after a permission or missing-scope
55
- response. Once selected, the same identity is used for the document body and
56
- all embedded resources. If `docs +fetch` lacks the required `--doc-format`
53
+ For Lark reads, set `CONTEXT_LARK_IDENTITY=user|bot` in the environment of every
54
+ Context invocation that may read Lark; the default is `user`. A host/Bot prompt
55
+ setting alone is not an exported environment variable. User mode reads only
56
+ as the current user. Bot mode reads as the configured application, then retries
57
+ once as the current user on a credential, scope or access denial. Subsequent
58
+ reads in that capture use the fallback identity, including pagination, synced
59
+ references, media, Sheets, Base and whiteboards. Network, rate-limit and format
60
+ errors do not switch identity. The diagnostic records any fallback.
61
+
62
+ This setting does not grant source access or change the intended audience of
63
+ the resulting knowledge. Do not use another person's credentials. For direct
64
+ host `lark-cli` reads, explicitly pass the selected `--as bot` or `--as user`
65
+ on every business read, including Wiki resolution/listing and asset reads.
66
+ If Bot access fails for the reasons above, retry that read once as user; stop
67
+ and report a pending source if user authorization is required. In a managed
68
+ runtime, use its authorization flow rather than repeatedly running `auth login`.
69
+ Local help and embedded skill discovery require no document authorization;
70
+ do not request user OAuth just to read a CLI guide.
71
+
72
+ If `docs +fetch` lacks the required `--doc-format`
57
73
  capability, follow the returned `lark-cli update` recovery and rerun the same
58
74
  Route command; do not replace the capture with a hand-written export.
59
75
 
@@ -63,9 +79,67 @@ are available while another capture remains pending. Keep unresolved sources in
63
79
  pending capture after the active production/review work, before delivery completes.
64
80
  This does not mark failed captures as complete or waive source-read authorization.
65
81
 
66
- For image-heavy tasks, reuse the image choice in the work-start report. When
67
- source descriptors already show more than 30 distinct images across the task,
68
- resolve that question before bulk media acquisition. If counts emerge only from
69
- capture, stop further image processing to confirm the choice during planning.
70
- Use explicit image/GIF reference-only policies for exclusions; never substitute
71
- temporary signed media URLs as permanent public image links.
82
+ ## Image acquisition before capture
83
+
84
+ The workflow instruction setting `DOCUMENT_IMAGE_CAPTURE` accepts `ON`, `OFF`,
85
+ or a positive integer document threshold; when absent it defaults to **10**.
86
+ Read it from the current task instructions or workspace guidance; a current
87
+ conversation instruction takes precedence. This is an Agent-interpreted setting,
88
+ not a CLI flag, environment variable, or SDK field. Hosts need not add a setting.
89
+
90
+ | Setting | Acquisition policy |
91
+ | --- | --- |
92
+ | `ON` | Include images without a document-count cutoff, subject to existing resource limits and explicit exclusions. |
93
+ | `OFF` | Capture bodies and image references only, regardless of document count. |
94
+ | positive integer `N` | Include images under the existing policy for at most `N` documents; above `N`, use references only. |
95
+ | absent | Use `10`. |
96
+
97
+ For an invalid value, report it and use `10` rather than silently enabling all
98
+ images or blocking the task. An explicit current-conversation request to include
99
+ all images selects `ON` for this task; an explicit request to skip images selects
100
+ `OFF`. If neither is present, use the configured setting. Do not write a temporary
101
+ conversation override back into permanent workspace guidance.
102
+
103
+ Count distinct documents
104
+ selected for this task, including Wiki descendants and in-scope linked documents,
105
+ not all historical workspace sources, API pages, retries, or output articles.
106
+ Deduplicate shortcuts and repeated links. Splitting the task into batches or
107
+ resuming it does not reset the count. Exactly 10 documents is within the default.
108
+
109
+ Before starting capture, the Agent separately checks the document count (or known
110
+ lower bound), setting, and effective image policy. This is an Agent self-check,
111
+ not a user confirmation gate: do not ask a question or wait for a reply. Above the
112
+ numeric threshold, automatically capture bodies with image references only; at or
113
+ below it, retain the existing image policy. `ON` and `OFF` apply regardless of count.
114
+ A generic
115
+ "capture everything", source-read permission, managed mode, or an old bundle setting
116
+ does not. Briefly report the count and applied policy in the work-start update and
117
+ retain the decision in task notes; do not repeat the update for every document.
118
+
119
+ If the count is unknown, first perform only authorized directory/metadata discovery
120
+ without image downloads. If body reads are needed to discover linked documents,
121
+ use a body-and-reference-only discovery pass within existing read authorization.
122
+ With a numeric setting, unknown totals do not authorize image acquisition; `ON`
123
+ does not require counting to enable images, and `OFF` never enables them.
124
+ Recalculate the task total before enabling images under a numeric setting.
125
+ If later expansion crosses the numeric threshold, apply the
126
+ reference-only policy before further acquisition and report the change without
127
+ waiting for a reply; retain any explicit all-image override and existing evidence.
128
+
129
+ For `OFF` or above-threshold tasks without an `ON` override, apply
130
+ `resources: { images: "reference-only", gifs: "reference-only" }` to the selected
131
+ Lark capture declarations before executing the Route. Preserve unrelated sources,
132
+ resource settings and existing stricter exclusions; inspect generated/dynamic
133
+ configuration rather than assuming registration applied the policy. Host prefetch
134
+ and import paths must honor the same choice, not download images before import.
135
+ Other resource types retain their existing policies. Do not edit snapshots or
136
+ invent unsupported flags; when a capture adapter cannot exclude images, explain
137
+ that limitation and resolve the acquisition method before downloading.
138
+
139
+ Preserve source links/placeholders and report skipped images as not acquired or
140
+ interpreted. This is a workflow instruction using existing resource policies, not
141
+ a new CLI hard gate or automatic document counter. For tasks that still include
142
+ images, retain the existing handling workflow for more than 30 distinct images
143
+ and reuse an explicit choice; do not invoke it for images skipped by this
144
+ preflight. Never substitute temporary signed media URLs as permanent
145
+ public image links.
@@ -71,6 +71,12 @@ settled scope, not a new confirmation step.
71
71
 
72
72
  ## Workflow
73
73
 
74
+ Before any capture or host prefetch, follow the task-wide image threshold and
75
+ Agent self-check in [Document capture](document-capture.md#image-acquisition-before-capture).
76
+ Do not ask the user to confirm this default or infer an all-image override from
77
+ source-read permission. Apply the effective resource policy before a managed batch;
78
+ registration defaults must not silently re-enable excluded images.
79
+
74
80
  Capture is entirely CLI-driven — your role is to register the right source,
75
81
  declare the matching capture phase, run the current `context run capture:*`
76
82
  command, and preserve its machine fields while summarizing the outcome in the