@schift-io/knowledge-scope 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/README.md CHANGED
@@ -1,61 +1,88 @@
1
1
  # Schift Knowledge Scope CE
2
2
 
3
- Connect an existing Schift Search index to your AI application and return cited evidence within
4
- one project's declared access boundary. Your application chooses the model and generates the answer.
3
+ Public source, contribution instructions, and releases:
4
+ [schift-io/knowledge-scope](https://github.com/schift-io/knowledge-scope).
5
+
6
+ Retrieve cited passages from your own Markdown or text files, then pass admitted evidence to your
7
+ AI application. Your application chooses the model and generates the answer.
8
+
9
+ The local-file quickstart requires **0.2.0 or later**. If you use `0.1.0`, upgrade first or use the
10
+ [hosted Search path](#hosted-search-advanced).
5
11
 
6
12
  Start with the [first retrieval](#quickstart), then use the SDK in your application. For a customer
7
13
  trial, follow the [pilot guide](docs/PILOT.md), which separates local verification from live-customer
8
14
  acceptance.
9
15
 
16
+ ## Quickstart
17
+
18
+ Start with a synthetic support handbook; no Schift account, API token, cloud service, or model is
19
+ needed. You need Node.js 20 or later. Run these commands in your application directory:
20
+
21
+ ```bash
22
+ npm install @schift-io/knowledge-scope@0.2.0
23
+ npx --no-install schift-ks quickstart ./support-project \
24
+ --source ./node_modules/@schift-io/knowledge-scope/examples/local-documents/support-handbook.md \
25
+ --query '환불 규정'
26
+ ```
27
+
28
+ The destination must be new. Expect `result.status: "ready"` with a passage about the synthetic
29
+ 14-day refund window and a citation identifying its source and line range. Local citations use
30
+ `schift://local-documents/...#Lx-Ly`; they identify snapshot evidence, not a public web page or
31
+ file-opening link. The result also includes the original `sourcePath`, whose current contents may
32
+ have changed since import. This is retrieved evidence, not an AI-generated answer. Keep the
33
+ returned `installationId` to ask again:
34
+
35
+ ```bash
36
+ npx --no-install schift-ks query '<installation-id>' --query '배송 기간'
37
+ ```
38
+
39
+ Next, substitute your own UTF-8 `.md` or `.txt` file, or a folder containing those files:
40
+
41
+ ```bash
42
+ npx --no-install schift-ks quickstart ./my-project \
43
+ --source ./my-documents --query '환불 규정'
44
+ ```
45
+
10
46
  ```text
11
- scope.json + schema files
12
- │ validate + lock
13
-
14
- portable KnowledgeScopeDefinition
15
- │ mount
16
-
17
- server-owned KnowledgeScopeMount
18
- │ declared operation only
19
-
20
- Open Connector / Schift Search / injected records port
21
- │ normalize + authorize + admit
22
-
23
- CandidateEnvelope[] + admission receipt
47
+ Your text files -> private local snapshot -> cited evidence -> your application's chosen model
24
48
  ```
25
49
 
26
- ## What is implemented
50
+ This path uses lexical search, not embeddings, semantic retrieval, or reranking. Use words present
51
+ in the source. A matching passage is not proof that it answers the question. `insufficient_evidence`
52
+ means your application should withhold an answer, not bypass admission.
27
53
 
28
- - [x] Portable Definition and server-owned Mount are separate contracts.
29
- - [x] The lock covers canonical `scope.json` plus every referenced input/result schema.
30
- - [x] Local mount state uses owner-only, atomic file persistence and optimistic revisions.
31
- - [x] Authorization decisions HMAC-bind the complete immutable Candidate evidence projection and
32
- survive process restarts.
33
- - [x] Open Connector executes declared actions through its public runtime API.
34
- - [x] Schift Search uses the authenticated v2 status + retrieve APIs.
35
- - [x] Direct named-record execution is available through an injected application port.
36
- - [x] Candidate admission checks source, operation, provider, permission mode, Scope, citation,
37
- freshness, connector audit correlation, and required provider scopes.
38
- - [x] Aggregate admission enforces every declared `minEvidence` coverage assertion.
39
- - [x] `run-batch` combines up to eight declared operations under one mount and admits their evidence together.
40
- - [x] CLI and loopback HTTP API use the same application and persistent state.
41
- - [ ] npm publication, Schift Cloud multi-tenant persistence, production deployment, and live
42
- provider-account certification. Those are separate operational actions.
54
+ The source text is copied into a private local snapshot outside the portable Pack. Keep local
55
+ state private; do not publish it with the Pack. Editing the original files does not update an
56
+ existing snapshot. To refresh, run quickstart with a new project directory and use its new
57
+ installation. This is not continuous sync or live document-ACL enforcement. Local filesystem
58
+ access is the security boundary; a tenant label is not user authentication.
43
59
 
44
- OBS, Context Runtime/A2A, APM, Agent execution, Workflow execution, and final LLM generation are
45
- deliberately outside this package.
60
+ The generated policy accepts snapshots for 24 hours after import. After that, import again into a
61
+ new workspace; editing a timestamp is not a refresh. Unmounting revokes the installation but does
62
+ not delete its retained local snapshot. Only ingest trusted, stable local files: symlinks, hardlinks,
63
+ special files, and files changed during capture are rejected.
46
64
 
47
- ## Quickstart
65
+ Limits are 100 files, 1 MiB per file, 8 MiB total text, and 4,000 chunks. A single line may contain
66
+ at most 2,000 characters. Folder scans stop at 2,000 entries or 16 levels; hidden entries and
67
+ `node_modules` are ignored, and other file extensions inside a folder are skipped. An explicitly
68
+ selected unsupported file or a folder with no usable text fails with a recovery message.
69
+
70
+ PDF, Office files, URLs, crawling, and an MCP adapter are not bundled. Convert supported material
71
+ to approved text outside this package, or use an already populated Search index below. For the
72
+ sample's expected passages and a no-model application command, see the
73
+ [local document example](examples/local-documents/README.md).
48
74
 
49
- You need Node.js 20 or later, a package tarball, and an **already indexed** Schift Search corpus.
75
+ ## Hosted Search (advanced)
76
+
77
+ You need Node.js 20 or later and an **already indexed** Schift Search corpus.
50
78
  Obtain the Search endpoint, authorized token, organization ID, and index name from its owner.
51
- This package does not upload, parse, or index your documents. A new empty index will not produce
79
+ This hosted path does not upload, parse, or index your documents. A new empty index will not produce
52
80
  usable evidence.
53
81
 
54
- Until npm publication is completed, install the supplied artifact in your application directory.
55
- Replace the path with the actual tarball; do not assume the registry package is available:
82
+ Install the published package in your application directory:
56
83
 
57
84
  ```bash
58
- npm install /absolute/path/to/schift-io-knowledge-scope-0.1.0.tgz
85
+ npm install @schift-io/knowledge-scope@0.2.0
59
86
  npx --no-install schift-ks --help
60
87
  ```
61
88
 
@@ -99,7 +126,20 @@ validation before mounting; the recovery command does not claim that incomplete
99
126
 
100
127
  ## Use the evidence in your application
101
128
 
102
- The installed package includes a consumer that uses the same local state and provider environment:
129
+ For the local-file path, run the included consumer from your application directory.
130
+ The default local tenant is `local-tenant`; use the returned tenant if you supplied `--tenant`:
131
+
132
+ ```bash
133
+ node node_modules/@schift-io/knowledge-scope/examples/consumer.mjs \
134
+ '<installation-id>' local-tenant '환불 규정' search
135
+ ```
136
+
137
+ `createCliDependencies().embedded` loads the same local state used by the CLI, including local
138
+ document snapshots. Keep the same `SCHIFT_KS_HOME` if you override the state directory. No model
139
+ credentials are needed to inspect the evidence; your application controls whether to send private
140
+ passages to an external model.
141
+
142
+ For a hosted Search installation, use its authorized tenant and provider environment instead:
103
143
 
104
144
  ```bash
105
145
  node node_modules/@schift-io/knowledge-scope/examples/consumer.mjs \
@@ -120,6 +160,35 @@ For offline retrieval measurements, see the [evaluation example](examples/evalua
120
160
  and the [pilot metric definitions](docs/PILOT.md#measure-a-useful-outcome). The included dataset is
121
161
  synthetic and makes no accuracy claim about a live provider.
122
162
 
163
+ ## What is implemented
164
+
165
+ ```text
166
+ scope.json + schemas -> validate + lock -> portable definition
167
+ -> mount with private bindings -> declared operation
168
+ -> local documents / Open Connector / Schift Search / injected records
169
+ -> normalize + authorize + admit -> cited evidence for your application
170
+ ```
171
+
172
+ - [x] Portable Definition and server-owned Mount are separate contracts.
173
+ - [x] The lock covers canonical `scope.json` plus every referenced input/result schema.
174
+ - [x] Local mount state uses owner-only, atomic file persistence and optimistic revisions.
175
+ - [x] Authorization decisions HMAC-bind the complete immutable Candidate evidence projection and
176
+ survive process restarts.
177
+ - [x] Open Connector executes declared actions through its public runtime API.
178
+ - [x] Schift Search uses the authenticated v2 status + retrieve APIs.
179
+ - [x] Direct named-record execution is available through an injected application port.
180
+ - [x] Candidate admission checks source, operation, provider, permission mode, Scope, citation,
181
+ freshness, connector audit correlation, and required provider scopes.
182
+ - [x] Aggregate admission enforces every declared `minEvidence` coverage assertion.
183
+ - [x] `run-batch` combines up to eight declared operations under one mount and admits their evidence together.
184
+ - [x] CLI and loopback HTTP API use the same application and persistent state.
185
+ - [x] Local Markdown/text quickstart and repeated queries with cited snapshot evidence.
186
+ - [ ] Schift Cloud multi-tenant persistence, production deployment, and live
187
+ provider-account certification. Those are separate operational actions.
188
+
189
+ OBS, Context Runtime/A2A, APM, Agent execution, Workflow execution, and final LLM generation are
190
+ deliberately outside this package.
191
+
123
192
  ## Manual authoring
124
193
 
125
194
  For a complete editable definition, copy the shipped support example into a new directory from
@@ -233,8 +302,8 @@ and a non-zero exit status.
233
302
  Provider URLs and credentials are runtime configuration. They are never written to `scope.json`,
234
303
  the lock, mount state, Candidate output, or errors.
235
304
 
236
- Open Connector is the product in `core-dependencies/schift-connector`; it owns account connections,
237
- credentials, and its public action runtime. Configure its endpoint:
305
+ Open Connector is a separately operated service that owns account connections, credentials, and
306
+ its public action runtime. Its implementation is not included in this repository. Configure its endpoint:
238
307
 
239
308
  ```bash
240
309
  export SCHIFT_KS_OPEN_CONNECTOR_URL=http://127.0.0.1:3000
@@ -291,7 +360,7 @@ Start the same application as a loopback service:
291
360
  export SCHIFT_KS_ORGANIZATION_ID=org.acme
292
361
  export SCHIFT_KS_TENANT=tenant.acme
293
362
  export SCHIFT_KS_API_TOKEN='<random owner-only token>'
294
- node dist/main.js serve --host 127.0.0.1 --port 8787
363
+ npx --no-install schift-ks serve --host 127.0.0.1 --port 8787
295
364
  ```
296
365
 
297
366
  Routes:
@@ -4120,6 +4120,10 @@ var SearchProviderSchema = exports_external.object({
4120
4120
  kind: exports_external.literal("schift_search"),
4121
4121
  indexRef: KnowledgeScopeIdentifierSchema
4122
4122
  }).strict();
4123
+ var LocalDocumentsProviderSchema = exports_external.object({
4124
+ kind: exports_external.literal("local_documents"),
4125
+ indexRef: KnowledgeScopeIdentifierSchema
4126
+ }).strict();
4123
4127
  var WebProviderSchema = exports_external.object({
4124
4128
  kind: exports_external.literal("web_search"),
4125
4129
  provider: exports_external.enum(["customer", "schift"])
@@ -4128,6 +4132,7 @@ var QueryProviderSchema = exports_external.discriminatedUnion("kind", [
4128
4132
  RecordsProviderSchema,
4129
4133
  ConnectorProviderSchema,
4130
4134
  SearchProviderSchema,
4135
+ LocalDocumentsProviderSchema,
4131
4136
  WebProviderSchema
4132
4137
  ]).readonly();
4133
4138
  var QueryCapabilitySchema = exports_external.object({
@@ -4236,6 +4241,7 @@ var CandidateProviderEvidenceSchema = exports_external.discriminatedUnion("kind"
4236
4241
  auditPersisted: exports_external.boolean()
4237
4242
  }).strict(),
4238
4243
  SearchProviderSchema,
4244
+ LocalDocumentsProviderSchema,
4239
4245
  WebProviderSchema
4240
4246
  ]).readonly();
4241
4247
  var CandidateEnvelopeSchema = exports_external.object({
@@ -4337,6 +4343,7 @@ var bindingMatchesCapability = (binding, capability) => {
4337
4343
  case "open_connector_action":
4338
4344
  return binding.providerRef === capability.provider.actionId && binding.connectorRef === capability.provider.connectorRef;
4339
4345
  case "schift_search":
4346
+ case "local_documents":
4340
4347
  return binding.providerRef === capability.provider.indexRef && binding.connectorRef === undefined;
4341
4348
  case "web_search":
4342
4349
  return binding.providerRef === capability.provider.provider && binding.connectorRef === undefined;
@@ -4480,6 +4487,10 @@ var ProviderEvidenceSchema = exports_external.discriminatedUnion("kind", [
4480
4487
  kind: exports_external.literal("schift_search"),
4481
4488
  indexRef: KnowledgeScopeIdentifierSchema
4482
4489
  }).strict(),
4490
+ exports_external.object({
4491
+ kind: exports_external.literal("local_documents"),
4492
+ indexRef: KnowledgeScopeIdentifierSchema
4493
+ }).strict(),
4483
4494
  exports_external.object({
4484
4495
  kind: exports_external.literal("web_search"),
4485
4496
  provider: exports_external.enum(["customer", "schift"])
@@ -4638,6 +4649,8 @@ var providerEvidenceDenial = (capability, binding, candidate) => {
4638
4649
  return evidence.auditPersisted ? undefined : "connector_audit_missing";
4639
4650
  case "schift_search":
4640
4651
  return evidence.kind === "schift_search" && evidence.indexRef === capability.provider.indexRef ? undefined : "provider_evidence_mismatch";
4652
+ case "local_documents":
4653
+ return evidence.kind === "local_documents" && evidence.indexRef === capability.provider.indexRef ? undefined : "provider_evidence_mismatch";
4641
4654
  case "web_search":
4642
4655
  return evidence.kind === "web_search" && evidence.provider === capability.provider.provider ? undefined : "provider_evidence_mismatch";
4643
4656
  }