sonorance 0.1.0-beta.4.1
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 +174 -0
- package/README.md +103 -0
- package/build/icon.png +0 -0
- package/package.json +86 -0
- package/skill/SKILL.md +41 -0
- package/skill/scripts/sonorance.mjs +31 -0
- package/src/azure-monitor.mjs +221 -0
- package/src/cli.mjs +315 -0
- package/src/comment-client.mjs +75 -0
- package/src/engine-default.mjs +136 -0
- package/src/feedback.mjs +151 -0
- package/src/gitignore.mjs +27 -0
- package/src/grammar.mjs +55 -0
- package/src/identity.mjs +126 -0
- package/src/otlp.mjs +166 -0
- package/src/plugins/deliberate/contribute.mjs +28 -0
- package/src/plugins/deliberate/domain.mjs +40 -0
- package/src/plugins/deliberate/frontmatter.mjs +85 -0
- package/src/plugins/deliberate/gitignore.mjs +21 -0
- package/src/plugins/deliberate/kinds.mjs +44 -0
- package/src/plugins/deliberate/markdown.mjs +42 -0
- package/src/plugins/deliberate/paths.mjs +245 -0
- package/src/plugins/deliberate/stages.mjs +27 -0
- package/src/plugins/deliberate/vault.mjs +1043 -0
- package/src/plugins.mjs +91 -0
- package/src/release-config.mjs +2 -0
- package/src/scrubber.mjs +64 -0
- package/src/server/index.mjs +993 -0
- package/src/sources.mjs +80 -0
- package/src/telemetry-schema.mjs +187 -0
- package/src/telemetry.mjs +390 -0
- package/src/ui/active-line.mjs +42 -0
- package/src/ui/app.js +3553 -0
- package/src/ui/at-mention.mjs +67 -0
- package/src/ui/comments-plugin.mjs +107 -0
- package/src/ui/diff-plugin.mjs +73 -0
- package/src/ui/editor.mjs +210 -0
- package/src/ui/index.html +1723 -0
- package/src/ui/md.mjs +233 -0
- package/src/ui/paste-md.mjs +54 -0
- package/src/ui/shell.html +1374 -0
- package/src/ui/slash.mjs +122 -0
- package/src/vault-registry.mjs +150 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean any work of authorship, including
|
|
48
|
+
the original version of the Work and any modifications or additions
|
|
49
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
50
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
51
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
52
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
53
|
+
means any form of electronic, verbal, or written communication sent
|
|
54
|
+
to the Licensor or its representatives, including but not limited to
|
|
55
|
+
communication on electronic mailing lists, source code control systems,
|
|
56
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
57
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
58
|
+
excluding communication that is conspicuously marked or otherwise
|
|
59
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
60
|
+
|
|
61
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
62
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
63
|
+
subsequently incorporated within the Work.
|
|
64
|
+
|
|
65
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
66
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
67
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
68
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
69
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
70
|
+
Work and such Derivative Works in Source or Object form.
|
|
71
|
+
|
|
72
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
(except as stated in this section) patent license to make, have made,
|
|
76
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
77
|
+
where such license applies only to those patent claims licensable
|
|
78
|
+
by such Contributor that are necessarily infringed by their
|
|
79
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
80
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
81
|
+
institute patent litigation against any entity (including a
|
|
82
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
83
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
84
|
+
or contributory patent infringement, then any patent licenses
|
|
85
|
+
granted to You under this License for that Work shall terminate
|
|
86
|
+
as of the date such litigation is filed.
|
|
87
|
+
|
|
88
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
89
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
90
|
+
modifications, and in Source or Object form, provided that You
|
|
91
|
+
meet the following conditions:
|
|
92
|
+
|
|
93
|
+
(a) You must give any other recipients of the Work or
|
|
94
|
+
Derivative Works a copy of this License; and
|
|
95
|
+
|
|
96
|
+
(b) You must cause any modified files to carry prominent notices
|
|
97
|
+
stating that You changed the files; and
|
|
98
|
+
|
|
99
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
100
|
+
that You distribute, all copyright, patent, trademark, and
|
|
101
|
+
attribution notices from the Source form of the Work,
|
|
102
|
+
excluding those notices that do not pertain to any part of
|
|
103
|
+
the Derivative Works; and
|
|
104
|
+
|
|
105
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
106
|
+
distribution, then any Derivative Works that You distribute must
|
|
107
|
+
include a readable copy of the attribution notices contained
|
|
108
|
+
within such NOTICE file, excluding those notices that do not
|
|
109
|
+
pertain to any part of the Derivative Works, in at least one
|
|
110
|
+
of the following places: within a NOTICE text file distributed
|
|
111
|
+
as part of the Derivative Works; within the Source form or
|
|
112
|
+
documentation, if provided along with the Derivative Works; or,
|
|
113
|
+
within a display generated by the Derivative Works, if and
|
|
114
|
+
wherever such third-party notices normally appear. The contents
|
|
115
|
+
of the NOTICE file are for informational purposes only and do not
|
|
116
|
+
modify the License. You may add Your own attribution notices
|
|
117
|
+
within Derivative Works, alongside or as an addendum to the NOTICE
|
|
118
|
+
text from the Work, provided that such additional attribution
|
|
119
|
+
notices cannot be construed as modifying the License.
|
|
120
|
+
|
|
121
|
+
You may add Your own copyright statement to Your modifications and
|
|
122
|
+
may provide additional or different license terms and conditions
|
|
123
|
+
for use, reproduction, or distribution of Your modifications, or for
|
|
124
|
+
any such Derivative Works as a whole, provided Your use, reproduction,
|
|
125
|
+
and distribution of the Work otherwise complies with the conditions
|
|
126
|
+
stated in this License.
|
|
127
|
+
|
|
128
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
129
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
130
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
131
|
+
this License, without any additional terms or conditions.
|
|
132
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
133
|
+
the terms of any separate license agreement you may have executed
|
|
134
|
+
with Licensor regarding such Contributions.
|
|
135
|
+
|
|
136
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
137
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
138
|
+
except as required for reasonable and customary use in describing the
|
|
139
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
140
|
+
|
|
141
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
142
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
143
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
144
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
145
|
+
implied, including, without limitation, any warranties or conditions
|
|
146
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
147
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
148
|
+
appropriateness of using or redistributing the Work and assume any
|
|
149
|
+
risks associated with Your exercise of permissions under this License.
|
|
150
|
+
|
|
151
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
152
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
153
|
+
unless required by applicable law (such as deliberate and grossly
|
|
154
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
155
|
+
liable to You for damages, including any direct, indirect, special,
|
|
156
|
+
incidental, or consequential damages of any character arising as a
|
|
157
|
+
result of this License or out of the use or inability to use the
|
|
158
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
159
|
+
work stoppage, computer failure or malfunction, or any and all other
|
|
160
|
+
commercial damages or losses), even if such Contributor has been
|
|
161
|
+
advised of the possibility of such damages.
|
|
162
|
+
|
|
163
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
164
|
+
the Work or Derivative Works thereof, You may choose to offer, and
|
|
165
|
+
charge a fee for, acceptance of support, warranty, indemnity, or
|
|
166
|
+
other liability obligations and/or rights consistent with this
|
|
167
|
+
License. However, in accepting such obligations, You may act only
|
|
168
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
169
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
170
|
+
defend, and hold each Contributor harmless for any liability
|
|
171
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
172
|
+
of your accepting any such warranty or additional liability.
|
|
173
|
+
|
|
174
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Sonorance
|
|
2
|
+
|
|
3
|
+
Sonorance is a local web application for reviewing and addressing work stored in Markdown files. It provides an Explorer, editing, search, git diff, inline comments, and a comment bridge for coding agents.
|
|
4
|
+
|
|
5
|
+
## Run it
|
|
6
|
+
|
|
7
|
+
Node.js 22.5 or newer is required.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx sonorance init
|
|
11
|
+
npx sonorance serve /path/to/folder --open
|
|
12
|
+
|
|
13
|
+
# From a source checkout:
|
|
14
|
+
npm install
|
|
15
|
+
node src/cli.mjs init
|
|
16
|
+
node src/cli.mjs serve /path/to/folder --open
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Every visible `.md` file appears in the Explorer. Frontmatter is preserved and hidden from the editor, links open separately, images resolve relative to their file, and autosave writes to disk. Git repositories also expose changed files, per-file diffs, and guarded discard.
|
|
20
|
+
|
|
21
|
+
## Project state
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
.sonorance/
|
|
25
|
+
config.json project identity and settings
|
|
26
|
+
plugins.json enabled bundled plugin ids
|
|
27
|
+
sources.md hand-editable grounding sources
|
|
28
|
+
local/
|
|
29
|
+
state.json machine-local tabs and Explorer state
|
|
30
|
+
comments.jsonl machine-local inline comments
|
|
31
|
+
serve.json running-server discovery
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Only `.sonorance/local/` is disposable and gitignored.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
node src/cli.mjs source add <location> ["<description>"]
|
|
38
|
+
node src/cli.mjs source list
|
|
39
|
+
node src/cli.mjs source remove <location>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Review workflow
|
|
43
|
+
|
|
44
|
+
1. Select text and leave a comment.
|
|
45
|
+
2. Run `/sonorance address` in the coding agent.
|
|
46
|
+
3. The agent reads the open comments, answers or edits the referenced file, and resolves completed items.
|
|
47
|
+
4. Review the result in Document or Diff mode.
|
|
48
|
+
|
|
49
|
+
The low-level bridge is:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
node src/cli.mjs comment list
|
|
53
|
+
node src/cli.mjs comment <commentId> resolve [--note "…"] [--revised]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Transport, HTTP, payload, server, and response-schema failures exit nonzero.
|
|
57
|
+
|
|
58
|
+
## Plugins
|
|
59
|
+
|
|
60
|
+
Sonorance resolves enabled bundled plugins from `.sonorance/plugins.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{ "plugins": [{ "id": "deliberate", "enabled": true }] }
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Plugins contribute document kinds, record storage, and gitignore behavior to the generic engine. They cannot load executable paths from vault configuration, replace the engine, or change the application identity.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
import { startServer } from 'sonorance';
|
|
70
|
+
import { resolveEngine } from 'sonorance/plugins';
|
|
71
|
+
|
|
72
|
+
const engine = await resolveEngine(process.cwd());
|
|
73
|
+
await startServer({ engine, port: 7777 });
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Privacy and telemetry
|
|
77
|
+
|
|
78
|
+
Privacy is foundational to Sonorance. Anonymous usage telemetry is on by default in the official npm package so we can understand which features help, improve performance, fix issues, and keep developing the product.
|
|
79
|
+
|
|
80
|
+
Sonorance collects only a small amount of content-free data: feature usage, performance measurements, and redacted error signals. All exported telemetry is anonymized, allow-listed, and stripped of sensitive information. Sonorance never logs your work—not even project, file, or folder names. File and document contents, titles, paths, prompts, completions, error messages, and stack traces always stay private.
|
|
81
|
+
|
|
82
|
+
Telemetry is written to a local JSONL audit trail before export so you can inspect what Sonorance records. You can turn telemetry off at any time in Settings, through the CLI/environment, or with a committed project policy. Feedback is separate and is sent only when you explicitly submit it.
|
|
83
|
+
|
|
84
|
+
Source checkouts have no embedded destination. To export from a source checkout or override the package destination:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
export APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=…;IngestionEndpoint=https://<region>.in.applicationinsights.azure.com/"
|
|
88
|
+
# Or:
|
|
89
|
+
export SONORANCE_OTLP_ENDPOINT=https://collector.example
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`SONORANCE_TELEMETRY=off`, `DO_NOT_TRACK=1`, CI, and a project policy with `"telemetry": false` all disable export.
|
|
93
|
+
|
|
94
|
+
## Repository map
|
|
95
|
+
|
|
96
|
+
- `src/server/` — local HTTP API, SSE, git, files, comments, and telemetry ingestion.
|
|
97
|
+
- `src/ui/` — source shell/app, editor integration, Markdown conversion, comments, diff, and interaction plugins.
|
|
98
|
+
- `src/engine-default.mjs` — generic folder engine.
|
|
99
|
+
- `src/plugins.mjs` — bundled-id additive plugin composition.
|
|
100
|
+
- `src/plugins/deliberate/` — the Deliberate contribution and file-backed record store.
|
|
101
|
+
- `src/cli.mjs` and `src/grammar.mjs` — CLI implementation and command/filesystem grammar.
|
|
102
|
+
- `skill/` — the shipped `/sonorance` skill.
|
|
103
|
+
- `test/` — engine, server, CLI, telemetry, and jsdom UI coverage.
|
package/build/icon.png
ADDED
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sonorance",
|
|
3
|
+
"version": "0.1.0-beta.4.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Sonorance — a local agent-review workbench over Markdown: Explorer, editing, git diff, inline comments, search, and additive product plugins.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Sonorance/sonorance.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Sonorance/sonorance#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Sonorance/sonorance/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"markdown",
|
|
17
|
+
"agent",
|
|
18
|
+
"review",
|
|
19
|
+
"workbench"
|
|
20
|
+
],
|
|
21
|
+
"bin": {
|
|
22
|
+
"sonorance": "src/cli.mjs"
|
|
23
|
+
},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./src/server/index.mjs",
|
|
26
|
+
"./server": "./src/server/index.mjs",
|
|
27
|
+
"./engine-default": "./src/engine-default.mjs",
|
|
28
|
+
"./vault-registry": "./src/vault-registry.mjs",
|
|
29
|
+
"./telemetry.mjs": "./src/telemetry.mjs",
|
|
30
|
+
"./telemetry-schema.mjs": "./src/telemetry-schema.mjs",
|
|
31
|
+
"./feedback.mjs": "./src/feedback.mjs",
|
|
32
|
+
"./comment-client.mjs": "./src/comment-client.mjs",
|
|
33
|
+
"./identity.mjs": "./src/identity.mjs",
|
|
34
|
+
"./scrubber.mjs": "./src/scrubber.mjs",
|
|
35
|
+
"./plugins": "./src/plugins.mjs",
|
|
36
|
+
"./plugins/deliberate/*": "./src/plugins/deliberate/*"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "node scripts/build-ui.mjs",
|
|
40
|
+
"start": "npm run build && node src/cli.mjs serve",
|
|
41
|
+
"pretest": "npm run build",
|
|
42
|
+
"test": "node --test --test-force-exit --import ./test-setup.mjs",
|
|
43
|
+
"prepack": "npm run build",
|
|
44
|
+
"verify-package": "node scripts/verify-package.mjs"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=22.5.0"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"esbuild": "^0.28.1",
|
|
51
|
+
"jsdom": "^29.1.1"
|
|
52
|
+
},
|
|
53
|
+
"allowScripts": {
|
|
54
|
+
"esbuild@0.28.1": true
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@tiptap/core": "^3.27.3",
|
|
58
|
+
"@tiptap/extension-link": "^3.27.3",
|
|
59
|
+
"@tiptap/extension-placeholder": "^3.27.3",
|
|
60
|
+
"@tiptap/extension-table": "^3.27.3",
|
|
61
|
+
"@tiptap/extension-table-cell": "^3.27.3",
|
|
62
|
+
"@tiptap/extension-table-header": "^3.27.3",
|
|
63
|
+
"@tiptap/extension-table-row": "^3.27.3",
|
|
64
|
+
"@tiptap/extension-task-item": "^3.27.3",
|
|
65
|
+
"@tiptap/extension-task-list": "^3.27.3",
|
|
66
|
+
"@tiptap/pm": "^3.27.3",
|
|
67
|
+
"@tiptap/starter-kit": "^3.27.3",
|
|
68
|
+
"@tiptap/suggestion": "^3.27.3",
|
|
69
|
+
"mdast-util-gfm": "^3.1.0",
|
|
70
|
+
"mdast-util-to-markdown": "^2.1.2",
|
|
71
|
+
"remark-frontmatter": "^5.0.0",
|
|
72
|
+
"remark-gfm": "^4.0.1",
|
|
73
|
+
"remark-parse": "^11.0.0",
|
|
74
|
+
"unified": "^11.0.5"
|
|
75
|
+
},
|
|
76
|
+
"files": [
|
|
77
|
+
"build/icon.png",
|
|
78
|
+
"src",
|
|
79
|
+
"skill",
|
|
80
|
+
"README.md",
|
|
81
|
+
"LICENSE"
|
|
82
|
+
],
|
|
83
|
+
"publishConfig": {
|
|
84
|
+
"access": "public"
|
|
85
|
+
}
|
|
86
|
+
}
|
package/skill/SKILL.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sonorance
|
|
3
|
+
description: 'Use when the user wants to address, resolve, or act on comments and review notes they left in the Sonorance app. Sonorance is a local agent-review workbench over Markdown: readers select a span, leave a question or change request, inspect agent edits in Diff mode, and close the loop. This skill fetches open comments, answers or edits the referenced file, and marks each addressed comment resolved. Triggers — address comments, resolve comments, work through my review notes, act on the notes I left in the app.'
|
|
4
|
+
version: '0.1.0'
|
|
5
|
+
user-invocable: true
|
|
6
|
+
argument-hint: '[address | open]'
|
|
7
|
+
license: Apache-2.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Sonorance — address review comments with the agent
|
|
11
|
+
|
|
12
|
+
Sonorance is a local agent-review workbench over a folder of Markdown. A reader selects any span and leaves an inline question or change request; this skill lets the coding agent work through those comments, make grounded edits, and resolve the review loop.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
Define the launcher once per session:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
LAUNCHER = node .github/skills/sonorance/scripts/sonorance.mjs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Run everything below as `LAUNCHER <args>` (Node ≥ 22). The launcher talks to the running Sonorance app; start it with `sonorance serve` in the folder when needed.
|
|
23
|
+
|
|
24
|
+
## `address` — work through open comments
|
|
25
|
+
|
|
26
|
+
1. **Fetch.** Run `LAUNCHER comment list` → `{ comments: [ { id, file, anchor:{quote,heading}, body, addressing? }, ... ], count }`. Each open comment names the folder-relative `file` it annotates. If the command exits nonzero, surface the app/transport error; never treat failure as an empty queue.
|
|
27
|
+
2. **Address each comment.** Open the file and locate the quote under its heading. Answer a question in this conversation without changing the file. For a change request, edit the referenced file; confirm first when the edit is material or ambiguous. Follow any `addressing` guidance attached by a document kind.
|
|
28
|
+
3. **Resolve.** Run `LAUNCHER comment <commentId> resolve`; add `--revised` after editing and optionally `--note "<what you did>"`. Resolve only after the comment was actually addressed.
|
|
29
|
+
4. **Review.** Tell the user what you answered or changed. They inspect the resulting file and git diff in Sonorance.
|
|
30
|
+
|
|
31
|
+
## `open` — open the review workbench
|
|
32
|
+
|
|
33
|
+
Run `LAUNCHER serve --open` from the current folder. This starts Sonorance over that folder and opens the browser; it does not create a Deliberate workflow or reinterpret the files.
|
|
34
|
+
|
|
35
|
+
## Rules
|
|
36
|
+
|
|
37
|
+
- **Ground every answer and edit** in the file and the user's comment. Never invent content.
|
|
38
|
+
- **Files are the deliverable.** Edit the user's Markdown; their git records the revision.
|
|
39
|
+
- **Resolve only completed work.** Questions answered here and edits applied may be resolved; untouched comments remain open.
|
|
40
|
+
- **Keep the scope focused.** Address the reader's comments and preserve the existing document workflow.
|
|
41
|
+
- **Be concise.** Report what changed, not a wall of process text.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* sonorance.mjs — launcher the skill shells into. Resolves the Sonorance CLI and forwards
|
|
4
|
+
* all args + stdio to it, so SKILL.md never hard-codes an engine path. Resolution order:
|
|
5
|
+
* 1. $SONORANCE_ENGINE (explicit override)
|
|
6
|
+
* 2. ./engine.json { "engine": "/abs/path/to/src/cli.mjs" } (written by `sonorance install-skill`)
|
|
7
|
+
* 3. ../../src/cli.mjs (in-repo dev: skill/scripts → package root)
|
|
8
|
+
* The spawned CLI inherits cwd, so `address`/`resolve` act on the folder the user is in.
|
|
9
|
+
*/
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
12
|
+
import { dirname, join, resolve } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
|
|
17
|
+
function enginePath() {
|
|
18
|
+
const env = process.env.SONORANCE_ENGINE;
|
|
19
|
+
if (env && existsSync(env)) return env;
|
|
20
|
+
const cfg = join(here, 'engine.json');
|
|
21
|
+
if (existsSync(cfg)) { try { const e = JSON.parse(readFileSync(cfg, 'utf8')).engine; if (e && existsSync(e)) return e; } catch { /* ignore */ } }
|
|
22
|
+
return resolve(here, '../../src/cli.mjs');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const engine = enginePath();
|
|
26
|
+
if (!existsSync(engine)) {
|
|
27
|
+
console.error(`sonorance: engine not found at ${engine}. Set SONORANCE_ENGINE or re-run \`sonorance install-skill\`.`);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
const r = spawnSync(process.execPath, [engine, ...process.argv.slice(2)], { stdio: 'inherit' });
|
|
31
|
+
process.exit(r.status ?? 1);
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* azure-monitor.mjs — a small, dependency-free Azure Monitor / Application Insights exporter.
|
|
3
|
+
*
|
|
4
|
+
* This is the "Path B" transport: the client instruments with OpenTelemetry semantics (see
|
|
5
|
+
* telemetry.mjs) but exports straight to Azure Monitor's classic ingestion ("Breeze") endpoint
|
|
6
|
+
* using a caller-provided connection string — NO collector, NO gateway, NO Entra auth.
|
|
7
|
+
*
|
|
8
|
+
* Why hand-rolled and not `@azure/monitor-opentelemetry`: the house style is dependency-light and
|
|
9
|
+
* zero-build (see otlp.mjs). The Breeze envelope is a small, stable JSON contract, so we encode it
|
|
10
|
+
* directly and keep the app free of the heavy Azure SDK dependency tree. The OTLP exporter
|
|
11
|
+
* (otlp.mjs) still exists for the vendor-agnostic path (a self-hosted collector or any OTLP
|
|
12
|
+
* backend); the transport is chosen at flush time (telemetry.mjs → resolveTransport).
|
|
13
|
+
*
|
|
14
|
+
* Mapping OTel → App Insights tables:
|
|
15
|
+
* - product events → EventData (customEvents)
|
|
16
|
+
* - the `error` event → ExceptionData (exceptions; typeName only, NEVER a message/stack)
|
|
17
|
+
* - metric rollups → MetricData (customMetrics)
|
|
18
|
+
* - the session span → RequestData (requests)
|
|
19
|
+
* - command/stage spans → RemoteDependencyData (dependencies), correlated by operation id.
|
|
20
|
+
*/
|
|
21
|
+
import { traceIdOf } from './otlp.mjs';
|
|
22
|
+
import { RELEASE_AZURE_CONNECTION_STRING } from './release-config.mjs';
|
|
23
|
+
|
|
24
|
+
// ---- connection string ------------------------------------------------------
|
|
25
|
+
// Public source keeps this empty. The official npm release injects its destination while packing.
|
|
26
|
+
export const DEFAULT_CONNECTION_STRING = RELEASE_AZURE_CONNECTION_STRING;
|
|
27
|
+
|
|
28
|
+
export function azureConnectionString() {
|
|
29
|
+
return process.env.APPLICATIONINSIGHTS_CONNECTION_STRING
|
|
30
|
+
|| process.env.SONORANCE_AZURE_CONNECTION_STRING
|
|
31
|
+
|| DEFAULT_CONNECTION_STRING;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Parse `Key=Value;…` into { ikey, ingestionEndpoint }. Tolerant of casing/whitespace/order.
|
|
35
|
+
export function parseConnectionString(cs = azureConnectionString()) {
|
|
36
|
+
const map = {};
|
|
37
|
+
for (const part of String(cs || '').split(';')) {
|
|
38
|
+
const i = part.indexOf('='); if (i < 0) continue;
|
|
39
|
+
map[part.slice(0, i).trim().toLowerCase()] = part.slice(i + 1).trim();
|
|
40
|
+
}
|
|
41
|
+
const ikey = map.instrumentationkey || '';
|
|
42
|
+
// Modern connection strings always carry IngestionEndpoint; fall back to the legacy global dc.
|
|
43
|
+
let ingest = map.ingestionendpoint || (ikey ? 'https://dc.services.visualstudio.com' : '');
|
|
44
|
+
return { ikey, ingestionEndpoint: ingest.replace(/\/+$/, '') };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// The classic ingestion ("Breeze") track URL, or null if the connection string is unusable.
|
|
48
|
+
export function azureTrackUrl(cs = azureConnectionString()) {
|
|
49
|
+
const { ikey, ingestionEndpoint } = parseConnectionString(cs);
|
|
50
|
+
if (!ikey || !ingestionEndpoint) return null;
|
|
51
|
+
return `${ingestionEndpoint}/v2.1/track`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// ---- envelope primitives ----------------------------------------------------
|
|
55
|
+
// AI item name: `Microsoft.ApplicationInsights.<ikey-no-hyphens>.<Type>`.
|
|
56
|
+
const itemName = (ikey, type) => `Microsoft.ApplicationInsights.${String(ikey || '').replace(/-/g, '')}.${type}`;
|
|
57
|
+
|
|
58
|
+
// A .NET-style timespan `[d.]hh:mm:ss.fff` from a millisecond duration (AI request/dependency).
|
|
59
|
+
export function msToTimeSpan(ms) {
|
|
60
|
+
let n = Number(ms); if (!Number.isFinite(n) || n < 0) n = 0;
|
|
61
|
+
const pad = (v, l = 2) => String(v).padStart(l, '0');
|
|
62
|
+
const days = Math.floor(n / 86400000);
|
|
63
|
+
const hh = Math.floor((n / 3600000) % 24);
|
|
64
|
+
const mm = Math.floor((n / 60000) % 60);
|
|
65
|
+
const ss = Math.floor((n / 1000) % 60);
|
|
66
|
+
const fff = Math.floor(n % 1000);
|
|
67
|
+
const base = `${pad(hh)}:${pad(mm)}:${pad(ss)}.${pad(fff, 3)}`;
|
|
68
|
+
return days > 0 ? `${days}.${base}` : base;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Split a flat prop map into AI's { properties (strings), measurements (numbers) }.
|
|
72
|
+
function splitProps(props = {}) {
|
|
73
|
+
const properties = {}, measurements = {};
|
|
74
|
+
for (const [k, v] of Object.entries(props || {})) {
|
|
75
|
+
if (v == null) continue;
|
|
76
|
+
if (typeof v === 'number' && Number.isFinite(v)) measurements[k] = v;
|
|
77
|
+
else properties[k] = typeof v === 'boolean' ? String(v) : String(v);
|
|
78
|
+
}
|
|
79
|
+
return { properties, measurements };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// The well-known AI context tags that become first-class columns (user_Id, session_Id,
|
|
83
|
+
// operation_Id, application_Version, cloud_RoleName) — the correlation + segmentation backbone.
|
|
84
|
+
function baseTags(r = {}) {
|
|
85
|
+
const t = {};
|
|
86
|
+
if (r.install_id) { t['ai.user.id'] = String(r.install_id); t['ai.device.id'] = String(r.install_id); }
|
|
87
|
+
if (r.session_id) t['ai.session.id'] = String(r.session_id);
|
|
88
|
+
const opId = traceIdOf(r.session_id);
|
|
89
|
+
if (opId) t['ai.operation.id'] = opId;
|
|
90
|
+
if (r.version != null) t['ai.application.ver'] = String(r.version);
|
|
91
|
+
const role = [r.product, r.surface].filter(Boolean).join(':');
|
|
92
|
+
if (role) t['ai.cloud.role'] = role;
|
|
93
|
+
t['ai.internal.sdkVersion'] = 'sonorance:1';
|
|
94
|
+
return t;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// The identity/context that rides EVERY item as customDimensions (content-free, low-cardinality),
|
|
98
|
+
// so any table can be sliced by product/surface/version/os without a join.
|
|
99
|
+
function baseProps(r = {}) {
|
|
100
|
+
const p = {};
|
|
101
|
+
for (const k of ['telemetry_schema', 'install_id', 'project_key', 'product', 'version', 'surface', 'os', 'harness']) {
|
|
102
|
+
if (r[k] != null) p[k] = String(r[k]);
|
|
103
|
+
}
|
|
104
|
+
if (r.os_major != null) p.os_major = String(r.os_major);
|
|
105
|
+
if (r.node_major != null) p.node_major = String(r.node_major);
|
|
106
|
+
return p;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function envelope(shortType, baseType, baseData, ts, ikey, tags) {
|
|
110
|
+
return {
|
|
111
|
+
name: itemName(ikey, shortType),
|
|
112
|
+
time: new Date(ts || Date.now()).toISOString(),
|
|
113
|
+
iKey: ikey,
|
|
114
|
+
tags: tags || {},
|
|
115
|
+
data: { baseType, baseData },
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// ---- per-signal envelope builders -------------------------------------------
|
|
120
|
+
function eventEnvelope(name, props, ts, ikey, tags, commonProps) {
|
|
121
|
+
const { properties, measurements } = splitProps(props);
|
|
122
|
+
return envelope('Event', 'EventData', {
|
|
123
|
+
ver: 2, name,
|
|
124
|
+
properties: { ...commonProps, ...properties },
|
|
125
|
+
measurements,
|
|
126
|
+
}, ts, ikey, tags);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// The `error` event → an Exception. typeName is the error CLASS only; the message/stack is NEVER
|
|
130
|
+
// carried (privacy invariant — the class is low-cardinality, the message could be content).
|
|
131
|
+
function exceptionEnvelope(props, ts, ikey, tags, commonProps) {
|
|
132
|
+
const { properties } = splitProps(props);
|
|
133
|
+
const typeName = properties.class || 'Error';
|
|
134
|
+
return envelope('Exception', 'ExceptionData', {
|
|
135
|
+
ver: 2,
|
|
136
|
+
exceptions: [{ id: 1, typeName, message: '', hasFullStack: false, parsedStack: [] }],
|
|
137
|
+
severityLevel: 3,
|
|
138
|
+
properties: { ...commonProps, ...properties },
|
|
139
|
+
}, ts, ikey, tags);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function metricEnvelope(name, agg, ts, ikey, tags, commonProps) {
|
|
143
|
+
const dp = { name, kind: 1, value: Number(agg.value) || 0, count: Number(agg.count) || 1 };
|
|
144
|
+
if (agg.min != null) dp.min = agg.min;
|
|
145
|
+
if (agg.max != null) dp.max = agg.max;
|
|
146
|
+
return envelope('Metric', 'MetricData', {
|
|
147
|
+
ver: 2, metrics: [dp], properties: commonProps,
|
|
148
|
+
}, ts, ikey, tags);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function spanEnvelope(s, ikey, tags, commonProps) {
|
|
152
|
+
const dur = msToTimeSpan((s.end ?? s.start) - s.start);
|
|
153
|
+
const localTags = { ...tags };
|
|
154
|
+
if (s.traceId) localTags['ai.operation.id'] = s.traceId;
|
|
155
|
+
if (s.parentSpanId) localTags['ai.operation.parentId'] = s.parentSpanId;
|
|
156
|
+
const { properties } = splitProps(s.attributes || {});
|
|
157
|
+
const props = { ...commonProps, ...properties };
|
|
158
|
+
if (!s.parentSpanId) {
|
|
159
|
+
// The root session span → a Request (the "session" operation).
|
|
160
|
+
return envelope('Request', 'RequestData', {
|
|
161
|
+
ver: 2, id: s.spanId, name: s.name, duration: dur,
|
|
162
|
+
responseCode: s.ok === false ? '1' : '0', success: s.ok !== false,
|
|
163
|
+
properties: props,
|
|
164
|
+
}, s.start, ikey, localTags);
|
|
165
|
+
}
|
|
166
|
+
// A command/stage span → an in-process dependency, linked to the session operation.
|
|
167
|
+
return envelope('RemoteDependency', 'RemoteDependencyData', {
|
|
168
|
+
ver: 2, id: s.spanId, name: s.name, duration: dur,
|
|
169
|
+
resultCode: s.ok === false ? '1' : '0', success: s.ok !== false,
|
|
170
|
+
type: 'InProc', properties: props,
|
|
171
|
+
}, s.start, ikey, localTags);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ---- the encoder ------------------------------------------------------------
|
|
175
|
+
// Neutral buffers (the SAME shapes the OTLP path drains) → an array of AI envelopes.
|
|
176
|
+
export function encodeEnvelopes({ events = [], spans = [], counters = [], gauges = [], histograms = [], window } = {}, resource = {}, cs = azureConnectionString()) {
|
|
177
|
+
const { ikey } = parseConnectionString(cs);
|
|
178
|
+
const tags = baseTags(resource);
|
|
179
|
+
const commonProps = baseProps(resource);
|
|
180
|
+
const metricTs = window?.end || Date.now();
|
|
181
|
+
const out = [];
|
|
182
|
+
for (const e of events) {
|
|
183
|
+
if (e.name === 'error') out.push(exceptionEnvelope(e.props || e.attributes, e.ts, ikey, tags, commonProps));
|
|
184
|
+
else out.push(eventEnvelope(e.name, e.props || e.attributes, e.ts, ikey, tags, commonProps));
|
|
185
|
+
}
|
|
186
|
+
for (const s of spans) out.push(spanEnvelope(s, ikey, tags, commonProps));
|
|
187
|
+
for (const c of counters) out.push(metricEnvelope(c.name, { value: c.value, count: 1 }, metricTs, ikey, tags, commonProps));
|
|
188
|
+
for (const g of gauges) out.push(metricEnvelope(g.name, { value: g.value, count: 1, min: g.value, max: g.value }, metricTs, ikey, tags, commonProps));
|
|
189
|
+
for (const h of histograms) out.push(metricEnvelope(h.name, { value: h.sum, count: h.count, min: h.min, max: h.max }, metricTs, ikey, tags, commonProps));
|
|
190
|
+
return out;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// A single feedback record → an EventData custom event named `feedback`. Feedback is the one
|
|
194
|
+
// content-full channel (consented, user-authored): the message rides as a customDimension.
|
|
195
|
+
export function encodeFeedbackEnvelope(attributes = {}, resource = {}, cs = azureConnectionString()) {
|
|
196
|
+
const { ikey } = parseConnectionString(cs);
|
|
197
|
+
return eventEnvelope('feedback', attributes, Date.now(), ikey, baseTags(resource), baseProps(resource));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ---- sender -----------------------------------------------------------------
|
|
201
|
+
/**
|
|
202
|
+
* POST a batch of envelopes to the Breeze track endpoint. Fire-and-forget by design: resolves
|
|
203
|
+
* `{ ok }`, never throws, and a hard timeout aborts a stuck request. Failures are swallowed — the
|
|
204
|
+
* caller keeps its local JSONL audit trail as the durable/offline record.
|
|
205
|
+
*/
|
|
206
|
+
export async function sendAzure(envelopes, { endpoint = azureTrackUrl(), timeoutMs = 3000 } = {}) {
|
|
207
|
+
if (!endpoint || !Array.isArray(envelopes) || !envelopes.length) return { ok: false, error: 'no-endpoint-or-empty' };
|
|
208
|
+
const ac = new AbortController();
|
|
209
|
+
const t = setTimeout(() => ac.abort(), timeoutMs); t.unref?.();
|
|
210
|
+
try {
|
|
211
|
+
const res = await fetch(endpoint, {
|
|
212
|
+
method: 'POST',
|
|
213
|
+
headers: { 'content-type': 'application/json' },
|
|
214
|
+
body: JSON.stringify(envelopes),
|
|
215
|
+
signal: ac.signal,
|
|
216
|
+
});
|
|
217
|
+
return { ok: !!res && res.ok, status: res?.status };
|
|
218
|
+
} catch (e) {
|
|
219
|
+
return { ok: false, error: e?.name || 'error' };
|
|
220
|
+
} finally { clearTimeout(t); }
|
|
221
|
+
}
|