Skip to content

Commit 4877762

Browse files
authored
Merge pull request #9 from dAppCore/dev
chore: promote dev to main — mcp v0.17.0 (Mantis #1259, audit COMPLIANT)
2 parents 245c9e2 + 8d1c279 commit 4877762

3 files changed

Lines changed: 62 additions & 42 deletions

File tree

go/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ go 1.26.2
44

55
require (
66
dappco.re/go/io v0.9.0
7-
dappco.re/go/log v0.9.0
87
dappco.re/go/process v0.10.0
98
dappco.re/go/rag v0.10.0
109
dappco.re/go/ws v0.5.0
@@ -15,6 +14,7 @@ require (
1514
)
1615

1716
require (
17+
dappco.re/go/log v0.9.0 // indirect
1818
github.com/bahlo/generic-list-go v0.2.0 // indirect
1919
github.com/buger/jsonparser v1.1.1 // indirect
2020
github.com/cespare/xxhash/v2 v2.3.0 // indirect

go/pkg/mcp/agentic/coreio_compat.go

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,19 @@ var coreio = struct {
1414
Local: &localCoreFS{fs: (&core.Fs{}).New("/")},
1515
}
1616

17-
func localCoreFSErr(
18-
r core.Result,
19-
) (
20-
_ error, // result
21-
) {
22-
if r.OK {
23-
return nil
24-
}
25-
if err, ok := r.Value.(error); ok && err != nil {
26-
return err
27-
}
28-
if r.Value != nil {
29-
return core.E("localCoreFS", core.Sprint(r.Value), nil)
30-
}
31-
return core.E("localCoreFS", "operation failed", nil)
32-
}
33-
3417
func (l *localCoreFS) Read(path string) (
3518
string,
3619
error,
3720
) {
3821
r := l.fs.Read(path)
3922
if !r.OK {
40-
return "", localCoreFSErr(r)
23+
if err, ok := r.Value.(error); ok && err != nil {
24+
return "", err
25+
}
26+
if r.Value != nil {
27+
return "", core.E("localCoreFS", core.Sprint(r.Value), nil)
28+
}
29+
return "", core.E("localCoreFS", "operation failed", nil)
4130
}
4231
content, ok := r.Value.(string)
4332
if !ok {
@@ -51,7 +40,17 @@ func (l *localCoreFS) EnsureDir(
5140
) (
5241
_ error, // result
5342
) {
54-
return localCoreFSErr(l.fs.EnsureDir(path))
43+
r := l.fs.EnsureDir(path)
44+
if r.OK {
45+
return nil
46+
}
47+
if err, ok := r.Value.(error); ok && err != nil {
48+
return err
49+
}
50+
if r.Value != nil {
51+
return core.E("localCoreFS", core.Sprint(r.Value), nil)
52+
}
53+
return core.E("localCoreFS", "operation failed", nil)
5554
}
5655

5756
func (l *localCoreFS) List(path string) (
@@ -60,7 +59,13 @@ func (l *localCoreFS) List(path string) (
6059
) {
6160
r := l.fs.List(path)
6261
if !r.OK {
63-
return nil, localCoreFSErr(r)
62+
if err, ok := r.Value.(error); ok && err != nil {
63+
return nil, err
64+
}
65+
if r.Value != nil {
66+
return nil, core.E("localCoreFS", core.Sprint(r.Value), nil)
67+
}
68+
return nil, core.E("localCoreFS", "operation failed", nil)
6469
}
6570
entries, ok := r.Value.([]core.FsDirEntry)
6671
if !ok {
@@ -78,5 +83,15 @@ func (l *localCoreFS) Delete(
7883
) (
7984
_ error, // result
8085
) {
81-
return localCoreFSErr(l.fs.Delete(path))
86+
r := l.fs.Delete(path)
87+
if r.OK {
88+
return nil
89+
}
90+
if err, ok := r.Value.(error); ok && err != nil {
91+
return err
92+
}
93+
if r.Value != nil {
94+
return core.E("localCoreFS", core.Sprint(r.Value), nil)
95+
}
96+
return core.E("localCoreFS", "operation failed", nil)
8297
}

go/pkg/mcp/brain/client/coreio_compat.go

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,19 @@ var coreio = struct {
1414
Local: &localCoreFS{fs: (&core.Fs{}).New("/")},
1515
}
1616

17-
func localCoreFSErr(
18-
r core.Result,
19-
) (
20-
_ error, // result
21-
) {
22-
if r.OK {
23-
return nil
24-
}
25-
if err, ok := r.Value.(error); ok && err != nil {
26-
return err
27-
}
28-
if r.Value != nil {
29-
return core.E("localCoreFS", core.Sprint(r.Value), nil)
30-
}
31-
return core.E("localCoreFS", "operation failed", nil)
32-
}
33-
3417
func (l *localCoreFS) Stat(path string) (
3518
core.FsFileInfo,
3619
error,
3720
) {
3821
r := l.fs.Stat(path)
3922
if !r.OK {
40-
return nil, localCoreFSErr(r)
23+
if err, ok := r.Value.(error); ok && err != nil {
24+
return nil, err
25+
}
26+
if r.Value != nil {
27+
return nil, core.E("localCoreFS", core.Sprint(r.Value), nil)
28+
}
29+
return nil, core.E("localCoreFS", "operation failed", nil)
4130
}
4231
info, ok := r.Value.(core.FsFileInfo)
4332
if !ok {
@@ -52,7 +41,13 @@ func (l *localCoreFS) Read(path string) (
5241
) {
5342
r := l.fs.Read(path)
5443
if !r.OK {
55-
return "", localCoreFSErr(r)
44+
if err, ok := r.Value.(error); ok && err != nil {
45+
return "", err
46+
}
47+
if r.Value != nil {
48+
return "", core.E("localCoreFS", core.Sprint(r.Value), nil)
49+
}
50+
return "", core.E("localCoreFS", "operation failed", nil)
5651
}
5752
content, ok := r.Value.(string)
5853
if !ok {
@@ -68,5 +63,15 @@ func (l *localCoreFS) WriteMode(
6863
) (
6964
_ error, // result
7065
) {
71-
return localCoreFSErr(l.fs.WriteMode(path, content, mode))
66+
r := l.fs.WriteMode(path, content, mode)
67+
if r.OK {
68+
return nil
69+
}
70+
if err, ok := r.Value.(error); ok && err != nil {
71+
return err
72+
}
73+
if r.Value != nil {
74+
return core.E("localCoreFS", core.Sprint(r.Value), nil)
75+
}
76+
return core.E("localCoreFS", "operation failed", nil)
7277
}

0 commit comments

Comments
 (0)