@longtable/provider-claude 0.1.9

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 ADDED
@@ -0,0 +1,11 @@
1
+ # @longtable/provider-claude
2
+
3
+ Claude-specific adapter logic for LongTable.
4
+
5
+ This package does not define the product contract. It implements the Claude-facing surface after the contract is fixed in `@longtable/core`, `@longtable/checkpoints`, and `@longtable/setup` for LongTable.
6
+
7
+ Current responsibilities:
8
+
9
+ - structured checkpoint prompt rendering
10
+ - Claude runtime guidance shaping
11
+ - generated Claude runtime config fragments
@@ -0,0 +1,17 @@
1
+ import type { SetupPersistedOutput } from "@longtable/setup";
2
+ import { createClaudeRuntimeBridge } from "./index.js";
3
+ export interface ClaudeConfigFragment {
4
+ setupPath: string;
5
+ provider: "claude";
6
+ checkpointProtocol: "native_structured";
7
+ defaultInteractionMode: SetupPersistedOutput["defaultInteractionMode"];
8
+ profileSummary: {
9
+ field: string;
10
+ careerStage: string;
11
+ experienceLevel: string;
12
+ currentProjectType: string;
13
+ };
14
+ runtimeGuidance: ReturnType<typeof createClaudeRuntimeBridge>["runtimeDefaults"];
15
+ }
16
+ export declare function createClaudeConfigFragment(setup: SetupPersistedOutput, setupPath: string): ClaudeConfigFragment;
17
+ export declare function renderClaudeConfigJson(setup: SetupPersistedOutput, setupPath: string): string;
package/dist/config.js ADDED
@@ -0,0 +1,20 @@
1
+ import { createClaudeRuntimeBridge } from "./index.js";
2
+ export function createClaudeConfigFragment(setup, setupPath) {
3
+ const bridge = createClaudeRuntimeBridge(setup);
4
+ return {
5
+ setupPath,
6
+ provider: "claude",
7
+ checkpointProtocol: bridge.checkpointProtocol,
8
+ defaultInteractionMode: bridge.defaultInteractionMode,
9
+ profileSummary: {
10
+ field: bridge.profile.field,
11
+ careerStage: bridge.profile.careerStage,
12
+ experienceLevel: bridge.profile.experienceLevel,
13
+ currentProjectType: bridge.profile.currentProjectType ?? "unspecified research task"
14
+ },
15
+ runtimeGuidance: bridge.runtimeDefaults
16
+ };
17
+ }
18
+ export function renderClaudeConfigJson(setup, setupPath) {
19
+ return JSON.stringify(createClaudeConfigFragment(setup, setupPath), null, 2);
20
+ }
@@ -0,0 +1,46 @@
1
+ import type { CheckpointSignal, ResearcherProfile, ResolvedCheckpointPolicy, RuntimeGuidance } from "@longtable/checkpoints";
2
+ import type { NumberedCheckpointSpec, SetupPersistedOutput } from "@longtable/setup";
3
+ export interface ClaudeChoice {
4
+ id: string;
5
+ label: string;
6
+ }
7
+ export interface ClaudeStructuredCheckpoint {
8
+ title: string;
9
+ instructions?: string;
10
+ choices: ClaudeChoice[];
11
+ guidance?: {
12
+ closureDisposition: RuntimeGuidance["closureDisposition"];
13
+ minimumQuestions: number;
14
+ requiredSections: string[];
15
+ mandatoryQuestions: string[];
16
+ };
17
+ }
18
+ export interface ClaudeCheckpointContext {
19
+ profile: ResearcherProfile;
20
+ signal: CheckpointSignal;
21
+ spec: NumberedCheckpointSpec;
22
+ }
23
+ export interface ClaudeCheckpointResult {
24
+ policy: ResolvedCheckpointPolicy;
25
+ guidance: RuntimeGuidance;
26
+ structuredPrompt: ClaudeStructuredCheckpoint;
27
+ blocking: boolean;
28
+ }
29
+ export interface ClaudeRuntimeDefaults {
30
+ askAtLeastTwoQuestionsInExplore: boolean;
31
+ preserveNarrativeTraceInDraft: boolean;
32
+ requireWhyMayBeWrongInReview: boolean;
33
+ structuredQuestionBias: "strong";
34
+ }
35
+ export interface ClaudeRuntimeBridge {
36
+ provider: "claude";
37
+ checkpointProtocol: "native_structured";
38
+ supportsStructuredQuestions: true;
39
+ defaultInteractionMode: SetupPersistedOutput["defaultInteractionMode"];
40
+ profile: SetupPersistedOutput["profileSeed"];
41
+ runtimeDefaults: ClaudeRuntimeDefaults;
42
+ }
43
+ export declare function renderStructuredCheckpoint(spec: NumberedCheckpointSpec, guidance?: RuntimeGuidance): ClaudeStructuredCheckpoint;
44
+ export declare function createClaudeCheckpoint(context: ClaudeCheckpointContext): ClaudeCheckpointResult;
45
+ export declare function createClaudeRuntimeBridge(setup: SetupPersistedOutput): ClaudeRuntimeBridge;
46
+ export * from "./config.js";
package/dist/index.js ADDED
@@ -0,0 +1,69 @@
1
+ import { resolveCheckpointPolicy } from "@longtable/checkpoints";
2
+ import { resolveRuntimeGuidance } from "@longtable/checkpoints";
3
+ function buildRequiredSections(guidance) {
4
+ const sections = [];
5
+ if (guidance.preferQuestionsFirst || guidance.minimumQuestions > 0) {
6
+ sections.push("questions-first");
7
+ }
8
+ if (guidance.includeOpenTensions) {
9
+ sections.push("open-tensions");
10
+ }
11
+ if (guidance.includeWhyMayBeWrong) {
12
+ sections.push("why-this-may-be-wrong");
13
+ }
14
+ if (guidance.preserveNarrativeTrace) {
15
+ sections.push("narrative-trace");
16
+ }
17
+ if (guidance.surfaceHumanCommitment) {
18
+ sections.push("human-commitment");
19
+ }
20
+ return sections;
21
+ }
22
+ export function renderStructuredCheckpoint(spec, guidance) {
23
+ const instructions = [spec.instructions];
24
+ if (guidance) {
25
+ instructions.push(`Closure: ${guidance.closureDisposition}. Minimum questions before closure: ${guidance.minimumQuestions}.`);
26
+ }
27
+ return {
28
+ title: spec.title,
29
+ instructions: instructions.filter(Boolean).join(" "),
30
+ choices: spec.options.map((option) => ({
31
+ id: option.value,
32
+ label: option.label
33
+ })),
34
+ guidance: guidance
35
+ ? {
36
+ closureDisposition: guidance.closureDisposition,
37
+ minimumQuestions: guidance.minimumQuestions,
38
+ requiredSections: buildRequiredSections(guidance),
39
+ mandatoryQuestions: guidance.mandatoryQuestions
40
+ }
41
+ : undefined
42
+ };
43
+ }
44
+ export function createClaudeCheckpoint(context) {
45
+ const policy = resolveCheckpointPolicy(context.profile, context.signal);
46
+ const guidance = resolveRuntimeGuidance(context.profile, context.signal, policy);
47
+ return {
48
+ policy,
49
+ guidance,
50
+ structuredPrompt: renderStructuredCheckpoint(context.spec, guidance),
51
+ blocking: policy.blocking
52
+ };
53
+ }
54
+ export function createClaudeRuntimeBridge(setup) {
55
+ return {
56
+ provider: "claude",
57
+ checkpointProtocol: "native_structured",
58
+ supportsStructuredQuestions: true,
59
+ defaultInteractionMode: setup.defaultInteractionMode,
60
+ profile: setup.profileSeed,
61
+ runtimeDefaults: {
62
+ askAtLeastTwoQuestionsInExplore: true,
63
+ preserveNarrativeTraceInDraft: true,
64
+ requireWhyMayBeWrongInReview: true,
65
+ structuredQuestionBias: "strong"
66
+ }
67
+ };
68
+ }
69
+ export * from "./config.js";
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@longtable/provider-claude",
3
+ "version": "0.1.9",
4
+ "private": false,
5
+ "description": "Claude adapter surface for LongTable",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit"
22
+ },
23
+ "dependencies": {
24
+ "@longtable/checkpoints": "0.1.9",
25
+ "@longtable/core": "0.1.9",
26
+ "@longtable/setup": "0.1.9"
27
+ },
28
+ "devDependencies": {
29
+ "typescript": "^5.6.0"
30
+ },
31
+ "keywords": [
32
+ "longtable",
33
+ "research",
34
+ "claude",
35
+ "adapter"
36
+ ],
37
+ "author": "Hosung You",
38
+ "license": "MIT",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/HosungYou/LongTable.git"
42
+ },
43
+ "homepage": "https://github.com/HosungYou/LongTable#readme",
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
49
+ }
50
+ }