@nextclaw/x-harness 0.1.0 → 0.2.0
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/LICENSE +231 -6
- package/README.md +17 -3
- package/SOURCE.md +9 -0
- package/cli/main.js +232 -188
- package/dist/api.d.ts +56 -2
- package/dist/api.js +178 -75
- package/dist/boundary.js +1 -0
- package/dist/browser-common.d.ts +11 -0
- package/dist/browser-common.js +34 -18
- package/dist/browser-dom-capabilities.d.ts +9 -0
- package/dist/browser-dom-capabilities.js +131 -0
- package/dist/browser-dom-dependencies.d.ts +16 -0
- package/dist/browser-dom-dependencies.js +1 -0
- package/dist/browser-dom-editing.d.ts +166 -0
- package/dist/browser-dom-editing.js +418 -0
- package/dist/browser-dom-navigation.d.ts +18 -0
- package/dist/browser-dom-navigation.js +181 -0
- package/dist/browser-dom-network.d.ts +1 -0
- package/dist/browser-dom-network.js +128 -0
- package/dist/browser-dom-submission.d.ts +7 -0
- package/dist/browser-dom-submission.js +101 -0
- package/dist/browser-dom.d.ts +14 -2
- package/dist/browser-dom.js +120 -824
- package/dist/browser-native.d.ts +14 -1
- package/dist/browser-native.js +180 -143
- package/dist/browser.js +6 -2
- package/dist/creator-native.d.ts +3 -0
- package/dist/creator-native.js +113 -0
- package/dist/creator.js +1 -1
- package/dist/diagnostics.d.ts +11 -0
- package/dist/diagnostics.js +10 -0
- package/dist/growth-batch.d.ts +8 -0
- package/dist/growth-batch.js +190 -0
- package/dist/growth-constants.d.ts +5 -0
- package/dist/growth-constants.js +13 -0
- package/dist/growth-dependencies.d.ts +33 -0
- package/dist/growth-dependencies.js +1 -0
- package/dist/growth-execution.d.ts +17 -0
- package/dist/growth-execution.js +346 -0
- package/dist/growth-parallel.d.ts +8 -0
- package/dist/growth-parallel.js +332 -0
- package/dist/growth-plan.d.ts +9 -0
- package/dist/growth-plan.js +229 -0
- package/dist/growth-policy.d.ts +18 -0
- package/dist/growth-policy.js +208 -0
- package/dist/growth-publishing.d.ts +10 -0
- package/dist/growth-publishing.js +266 -0
- package/dist/growth-reading.d.ts +8 -0
- package/dist/growth-reading.js +157 -0
- package/dist/growth-recovery.d.ts +9 -0
- package/dist/growth-recovery.js +187 -0
- package/dist/growth-state.d.ts +16 -0
- package/dist/growth-state.js +220 -0
- package/dist/growth-tasks.d.ts +20 -0
- package/dist/growth-tasks.js +164 -0
- package/dist/growth.d.ts +26 -1
- package/dist/growth.js +211 -1908
- package/dist/platform-capabilities.d.ts +8 -0
- package/dist/platform-capabilities.js +29 -0
- package/dist/platform-collections.d.ts +14 -0
- package/dist/platform-collections.js +250 -0
- package/dist/platform-dependencies.d.ts +43 -0
- package/dist/platform-dependencies.js +1 -0
- package/dist/platform-diagnostics.d.ts +14 -0
- package/dist/platform-diagnostics.js +63 -0
- package/dist/platform-observation.d.ts +16 -0
- package/dist/platform-observation.js +96 -0
- package/dist/platform-rules.d.ts +17 -0
- package/dist/platform-rules.js +41 -0
- package/dist/platform-targets.d.ts +14 -0
- package/dist/platform-targets.js +154 -0
- package/dist/platform-writing.d.ts +16 -0
- package/dist/platform-writing.js +202 -0
- package/dist/platform.d.ts +23 -2
- package/dist/platform.js +125 -678
- package/dist/readers-actions.d.ts +2 -0
- package/dist/readers-actions.js +66 -0
- package/dist/readers-ax-host.d.ts +12 -0
- package/dist/readers-ax-host.js +134 -0
- package/dist/readers-ax-parser.d.ts +1 -0
- package/dist/readers-ax-parser.js +69 -0
- package/dist/readers-ax-program.d.ts +1 -0
- package/dist/readers-ax-program.js +5 -0
- package/dist/readers-ax-tree.d.ts +19 -0
- package/dist/readers-ax-tree.js +111 -0
- package/dist/readers-ax-views.d.ts +87 -0
- package/dist/readers-ax-views.js +247 -0
- package/dist/readers-cli.d.ts +6 -0
- package/dist/readers-cli.js +79 -0
- package/dist/readers-composer.d.ts +2 -0
- package/dist/readers-composer.js +131 -0
- package/dist/readers-navigation.d.ts +2 -0
- package/dist/readers-navigation.js +66 -0
- package/dist/readers-posts.d.ts +2 -0
- package/dist/readers-posts.js +141 -0
- package/dist/readers-profile.d.ts +3 -0
- package/dist/readers-profile.js +157 -0
- package/dist/readers.d.ts +9 -20
- package/dist/readers.js +9 -1045
- package/dist/results.js +1 -1
- package/dist/round-state.js +20 -3
- package/dist/store.d.ts +22 -4
- package/dist/store.js +173 -151
- package/dist/types.d.ts +10 -0
- package/dist/types.js +1 -0
- package/generated/observation.mjs +3 -2
- package/package.json +23 -9
- package/skill/SKILL.md +17 -36
- package/skill/references/api.md +7 -34
- package/skill/references/reads.md +23 -0
- package/skill/references/recovery.md +25 -0
- package/skill/references/setup.md +23 -0
- package/skill/references/writes.md +51 -0
package/skill/references/api.md
CHANGED
|
@@ -1,37 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# API navigation
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compatibility index; normal tasks route directly from the Skill. Load one current reference, not all files.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
maxScrolls: 8,
|
|
10
|
-
mode: "decision",
|
|
11
|
-
});
|
|
12
|
-
await x.searchSources({ query: "AI agents", limit: 5, mode: "decision" });
|
|
13
|
-
await x.readBookmarks({ folder: "FOLDER_NAME", limit: 5, mode: "decision" });
|
|
14
|
-
await x.inspectAccount({ mode: "decision" });
|
|
15
|
-
await x.readPost({ target: { postId, url, evidenceRef }, mode: "decision" });
|
|
16
|
-
await x.readPerson({ target: { handle, url, evidenceRef }, mode: "decision" });
|
|
17
|
-
await x.readFeedback({
|
|
18
|
-
targets: [{ postId, url, evidenceRef }],
|
|
19
|
-
mode: "decision",
|
|
20
|
-
});
|
|
21
|
-
await x.inspectRound({ taskId });
|
|
22
|
-
```
|
|
5
|
+
- Reading: [reads](reads.md).
|
|
6
|
+
- Reviewed writes/rounds: [writes](writes.md), matching operation heading.
|
|
7
|
+
- Failure/unknown submission: [recovery](recovery.md).
|
|
8
|
+
- Missing installation/workspace or update: [setup](setup.md).
|
|
23
9
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```js
|
|
27
|
-
await x.publishPost({ taskId, draftPath, preparedAction: originalAction });
|
|
28
|
-
await x.replyToPost({ taskId, postId, text, preparedAction: replyAction });
|
|
29
|
-
await x.followOne({ taskId, handle }); // action already prepared in the original ledger
|
|
30
|
-
await x.followBatch({ taskId, handles, preparedActions });
|
|
31
|
-
await x.verifySubmission({ taskId, actionId });
|
|
32
|
-
await x.verifyPublishedPost({ taskId, draftPath, publicURL, evidenceRef });
|
|
33
|
-
await x.verifyFollow({ handle, url, evidenceRef });
|
|
34
|
-
await x.runGrowthRound({ taskId, maxActions: 3 });
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Before preparing writes, read the appropriate installed PreparedAction and operation option types. Required reviewed evidence cannot be replaced with a made-up reference. Original posts include actual draftPath, complete text, observed compose URL/proof, author proof and approvedText/draftFingerprint quality. Reply/follow targets require observed evidence. Concurrent task tabs need an explicitly evidenced executor scope; see HarnessOptions/Executor. Business root calls own capability checks, intent journaling, single submission, public verification and ledger settlement.
|
|
10
|
+
Public declarations are the compatibility contract for custom integrations, not a prerequisite for documented calls.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Read tasks
|
|
2
|
+
|
|
3
|
+
Load for reading only. A valid root binding `x` with existing ledger/proof paths suffices; no write plan needed. `mode` defaults to `receipt`; use `decision` immediately when drafting/reviewing needs text. `delta` omits only unchanged evidence previously returned by this instance; after context loss use `decision`.
|
|
4
|
+
|
|
5
|
+
| API | Required | Optional |
|
|
6
|
+
| --- | --- | --- |
|
|
7
|
+
| readCreator | handle | target (default 10, 1–50), maxScrolls, navigate, expand, mode |
|
|
8
|
+
| readBookmarks | folder (observed name) | processedIds, limit, maxPages, mode |
|
|
9
|
+
| searchSources | query | processedIds, limit, maxPages, mode |
|
|
10
|
+
| readPost | target: {postId,url,evidenceRef} | mode |
|
|
11
|
+
| readPerson | target: {handle,url,evidenceRef} | mode |
|
|
12
|
+
| readFeedback | targets: [{postId,url,evidenceRef}] | replyLimit, mode |
|
|
13
|
+
| inspectAccount | none | mode |
|
|
14
|
+
| inspectRound | taskId (original batch ID) | none |
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
var result = await x.readCreator({ handle: selectedHandle, target: 5, mode: 'decision' });
|
|
18
|
+
var postResult = await x.readPost({ target: observedPost, mode: 'decision' });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Targets/proof come from actual observations, never guessed URLs or made-up references. API owns navigation/expansion and bounded collection. Native creator collection supports an already selected profile with `navigate:false`; it keeps relative times unknown and stops with partial evidence if the active page changes. Native automatic creator navigation remains `needsCapability`; inspect that signal before changing adapter.
|
|
22
|
+
|
|
23
|
+
Results include status/evidenceRef/missing/IDs/completeness. In `decision`, creator/bookmark/search use `sources`, post `post`, person `person`, feedback `feedback`; account includes accountHandle/accountURL. `observed` alone does not prove every requested field exists. `pageComplete:false` is a collection boundary, not proof of truncated target text. View media before describing it. Return complete chosen evidence; keep other observations local. Only on failure load recovery.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Recovery by signal
|
|
2
|
+
|
|
3
|
+
Load on failure/unknown only. Keep operation/status/missing/code/proof/error; never infer success or repeat identical failures.
|
|
4
|
+
|
|
5
|
+
| Signal | Next action and exit condition |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| unknown submission | `await x.verifySubmission({taskId,actionId})`, same IDs; no replacement action or new submission before resolution. |
|
|
8
|
+
| Existing public post needs recovery | `await x.verifyPublishedPost({taskId,draftPath,publicURL,evidenceRef})`; observed URL/proof. Optional sourceLink: {href,resolvedURL,evidenceRef,renderedText?}. |
|
|
9
|
+
| Follow needs independent recovery | `await x.verifyFollow({handle,url,evidenceRef,mode:'decision'})`; honor returned verified. Normal followBatch already verifies. |
|
|
10
|
+
| needsDecision | Resolve returned missing review/proof in original action, resume same ID. Current AI performs internal review under project contract. |
|
|
11
|
+
| waiting | Honor resumeAt/reason, continue independent permitted work; never bypass time/identity/claim gates. |
|
|
12
|
+
| needsCapability | Inspect exact missing method/operation. If a supported binding supplies it, rebind once and retry a necessary read; otherwise repair reported owner with failing sample and targeted validation. |
|
|
13
|
+
| diagnostic.next: inspect-local-proof | Read only `{operation,error}` from diagnostic.evidenceRef; resolve via this reference, keep full proof local. Unknown/intent needs same-ID verification. Unsupported: report code/error and update/support; no private source. |
|
|
14
|
+
| diagnostic.next: restore-proof-store | Restore the workspace's writable proof directory, then resume the same action. Do not replace its ledger or infer submission failure. |
|
|
15
|
+
| Missing fields/partial window | Narrow to target, expand/advance documented bounded window; preserve text. No whole-page output or automatic reload. |
|
|
16
|
+
|
|
17
|
+
## Host connection or native focus
|
|
18
|
+
|
|
19
|
+
Failure to list/bind Chrome is a host-connection failure before reaching X, not proof of logged-out X. Per current host documentation rediscover the task tab once; validate navigation plus a necessary visible read. Native focus rejection instead needs latest AX URL/window confirmation and one supported focus correction. Do not repeat discovery or restart editors blindly.
|
|
20
|
+
|
|
21
|
+
Lost tab: reuse a live owned tab or create a task tab in the same actual browser; preserve other editors. Native fallback changes binding to app, not business calls; unsupported native tasks remain gaps. Network/TUN observations do not authorize setting changes.
|
|
22
|
+
|
|
23
|
+
## Repair boundary
|
|
24
|
+
|
|
25
|
+
Normal use/known recovery need no source. Unresolved runtime defect/unsupported capability permits diagnostics: maintainers repair the owner, verify the failed boundary and return to root; consumers report gap/update/support, without private TS. Never scan adapters for arguments, add parsers, bypass refusal or resubmit unknown.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Setup and updates
|
|
2
|
+
|
|
3
|
+
Load only when runtime/workspace is absent, binding needs refreshing after update, or adapter scope changes.
|
|
4
|
+
|
|
5
|
+
## Repository runtime
|
|
6
|
+
|
|
7
|
+
Use `<repository>/dist/index.js` as an absolute file URL; if absent run `npm run build`. Reuse original ledger/proofs and private parent runtime-context entry; do not initialize a second ledger or download another runtime. Use this repository’s skill/ as the development Skill owner.
|
|
8
|
+
|
|
9
|
+
## Independent installation
|
|
10
|
+
|
|
11
|
+
Requires Node 22+, compatible CUA and own X login. Run `npx @nextclaw/x-harness@latest setup --target codex` (or `--target claude`); use returned moduleURL/cliPath. Setup substitutes placeholders. Skill text does not add browser access. Missing host/login is a prerequisite, not permission to invent execution.
|
|
12
|
+
|
|
13
|
+
Initialize once: `node <cliPath> init --directory <user workspace> --account <user handle>`. Reuse returned ledgerPath/proofDirectory/taskId; initialization plans zero writes. Existing project state remains its owner.
|
|
14
|
+
|
|
15
|
+
## Adapter and parallel scope
|
|
16
|
+
|
|
17
|
+
Host owns tab/app acquisition: read its current documentation once and reuse the valid handle. Tab needs url(), playwright.evaluate() and locators; native app AX/click/key/paste. Do not launch a separate driver.
|
|
18
|
+
|
|
19
|
+
Native binding: `{app,ledgerPath,proofDirectory}` instead of tab. Independent task tabs may add `executor:{id:taskId,scopeKinds:['original'],evidenceRef:scopeProof}` using actual authorized scope/proof; kinds are original/reply/follow. Never borrow another executor's editor or claim.
|
|
20
|
+
|
|
21
|
+
## Update
|
|
22
|
+
|
|
23
|
+
Independent installs run `npx @nextclaw/x-harness@latest update --target codex` (or claude); it backs up managed runtime/Skill and preserves workspaces. Repository users update the original repository owner. Rebind using the new versioned moduleURL returned by update or written into this Skill; it refreshes the whole dependency graph in a persistent REPL. Never reuse the previous URL or add a root-only query string. Preserve pending actions/editors; reacquire the task tab after a necessary host reset. Verify one necessary read with the new module, not all documents. Distributed Skill/runtime share a version. Free use follows bundled proprietary license; TS source remains private.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Writes and rounds
|
|
2
|
+
|
|
3
|
+
Load common review plus only the operation heading needed. Existing project contract owns authorization, identity, budgets, policy and original ledger plan. Independent initialization has zero planned writes; set only authorized counts in that ledger before executing. Current runtime window is 07:00–24:00 Asia/Shanghai for replies and 07:00–22:00 for other writes; follow gates require reviewed Chinese-language blue-check candidates. Do not expand scope. Examples below use existing real observations/proof; they are not executable authorization.
|
|
4
|
+
|
|
5
|
+
## Common review
|
|
6
|
+
|
|
7
|
+
A prepared action has id (stable original ID), status:'prepared', accountHandle, accountURL, accountEvidenceRef and quality. All proof references are existing files; URLs/identity must be actually observed. Already prepared ledger actions need not be prepared again.
|
|
8
|
+
|
|
9
|
+
Content quality: `{approved:true,approvedText:text,evidenceRef:reviewProof,draftFingerprint}`; original fingerprint is SHA-256 of exact draft file bytes. Use Node crypto/createHash and fs/readFileSync locally; this requires no runtime source. Reply quality needs approvedText/proof; original also needs draftFingerprint. Any changed text/file needs a fresh review. Follow quality: `{approved:true,handle,blue:true,chinese:true,evidenceRef:reviewProof}`; verify evidence, never infer blue from generic certification.
|
|
10
|
+
|
|
11
|
+
Action APIs return status/actionId/publicURL/evidenceRef and reason/missing/resumeAt when relevant. Verified requires public proof. Unknown loads recovery, never resubmits. Business calls own intent, submit once, fresh verification and original settlement.
|
|
12
|
+
|
|
13
|
+
## Publish
|
|
14
|
+
|
|
15
|
+
Additional fields: kind:'original', draftPath (existing .post.md), text (complete approved text), composeURL, composeEvidenceRef; optional assets:[{path,alt}], activation:'click'|'keyboard'. Every media path must exist and be reviewed.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
var result = await x.publishPost({ taskId, draftPath, preparedAction: {
|
|
19
|
+
id: actionId, status: 'prepared', kind: 'original',
|
|
20
|
+
accountHandle, accountURL, accountEvidenceRef,
|
|
21
|
+
quality: { approved: true, approvedText: text, evidenceRef: reviewProof, draftFingerprint },
|
|
22
|
+
draftPath, text, composeURL, composeEvidenceRef,
|
|
23
|
+
} });
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Optional independentExecution:{tabId,evidenceRef,scopeEvidenceRef} requires real independent task-tab/scope proof; binding executor scope is covered in setup only if needed. Existing original action can omit preparedAction; draftPath still required.
|
|
27
|
+
|
|
28
|
+
## Reply
|
|
29
|
+
|
|
30
|
+
Additional fields: kind:'reply', postId, url, evidenceRef (observed parent), text; optional assets/activation as above. Common account/quality fields still required. The exact parent is verified by the API.
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
var result = await x.replyToPost({ taskId, postId, text, preparedAction: {
|
|
34
|
+
id: actionId, status: 'prepared', kind: 'reply',
|
|
35
|
+
accountHandle, accountURL, accountEvidenceRef,
|
|
36
|
+
quality: { approved: true, approvedText: text, evidenceRef: reviewProof },
|
|
37
|
+
postId, url: parentURL, evidenceRef: parentProof, text,
|
|
38
|
+
} });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Follow
|
|
42
|
+
|
|
43
|
+
Additional fields: kind:'follow', handle, url, evidenceRef (observed person), plus common account fields and follow quality. Batch uses `{taskId,handles,preparedActions?}`; original contract determines allowed batch sizes. Each preparedAction corresponds to its handle. If already prepared, omit preparedActions. `await x.followOne({taskId,handle})` requires its original prepared action and project-permitted single-action scope. A preexisting relationship is not a new verified follow; honor result counts.
|
|
44
|
+
|
|
45
|
+
## Round
|
|
46
|
+
|
|
47
|
+
`await x.inspectRound({taskId})` inspects original state; `await x.runGrowthRound({taskId,maxActions})` runs/resumes it. maxActions bounds this call, not original planned total. Preparation uses decision:{type:'prepareActions',accountHandle,ownershipEvidenceRef,actions}; actions are the reviewed structures above.
|
|
48
|
+
|
|
49
|
+
Optional decision fields: attemptsCoverage:{complete,since,evidenceRef}, sharedAttempts:[{kind,at}], nextScheduledCheckAt. For follow budgets, coverage must actually cover the required window; unknown history cannot be recorded as zero. Missing data remains a decision gap.
|
|
50
|
+
|
|
51
|
+
Review an existing action with decision:{actionId,approved,evidenceRef,approvedText?,draftFingerprint?,blue?,chinese?}; use content fields for content, blue/chinese for follow. approved:false skips that candidate without filling original planned count. Preserve intent/unknown/verified states and IDs. Read returned gaps/decision/mayEnd; partial success is not whole-round completion.
|